package m.jclecai.com.utils;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;

import android.util.Log;

/**
 * 选号工具类
 *
 * @author Administrator
 *
 */
public class NumberTools {

    /**
     * 根据红球 和篮球个数获取注数（ 双色球 (S) 6+1大乐透(D)是 5+2）
     *
     * @param RedCount
     *            所选的红球个数
     * @param BlueCount
     *            所选的蓝球个数
     * @param RedNumber
     *            5,6 标准的红球个数
     * @param BlueNumber
     *            标准的蓝球个数
     * @return
     */
    public static long getCountForSD(int RedCount, int BlueCount,int RedNumber, int BlueNumber) {
        // 如果没有选满数字 则返回 0
        if ((RedCount < RedNumber) || (BlueCount < BlueNumber)) {
            return 0;
        }
        // 如果选择的红球和篮球 数量 等于 应该选的数量
        else if (RedCount == RedNumber && BlueCount == BlueNumber) {
            return 1;
        } else {
            // 红球的排列总数 变量
            long RedInvestNum = 1;

            for (int i = 0; i < RedNumber; i++) {
                RedInvestNum = RedInvestNum * RedCount;
                RedCount--;
            }
            long RedInvestNum2 = 1;
            for (int i = RedNumber; i > 0; i--) {
                RedInvestNum2 *= i;
            }
            RedInvestNum = RedInvestNum / RedInvestNum2;
            // 蓝球的排列总数 变量
            long BlueInvestNum = 1;
            // 如果篮球应该选的数量大于1 （也就是大乐透 5+2 形式的）
            if (BlueNumber > 1) {
                if (BlueCount > 2) {
                    for (int i = 3; i <= BlueCount; i++)
                        BlueInvestNum *= i;
                    for (int i = 2; i <= (BlueCount - 2); i++)
                        BlueInvestNum = Math.round(BlueInvestNum / i);
                }
                // 如果篮球应该选的数量==1 （也就是双色球 6+1 形式的）
            } else {
                BlueInvestNum = BlueCount;
            }
            return (RedInvestNum * BlueInvestNum);
        }
    }

    // 01 02 03 04 05 06-01 普通
    // 01 02 , 03 04 05 06 07-01 胆拖

    /** 格式化 双色球 **/
    public static String changeSSQ(List<String> red, List<String> redTuo,
                                   List<String> blue, int type) {
        String num = "";
        String tuoNum = "";
        String blueNum = "";

        for (String str : red) {
            num += str + " ";
        }

        if (redTuo != null) {
            for (String str : redTuo) {
                tuoNum += str + " ";
            }
        }

        for (String str : blue) {
            blueNum += str + " ";
        }

        if (type == 501) {
            num = num.trim() + "-" + blueNum;
        } else if (type == 502) {
            num = num + "," + " " + tuoNum.trim() + "-" + blueNum.trim();
        }

        return num;
    }

    public static String changeDLT(List<String> red, List<String> redTuo,
                                   List<String> blue, int type) {
        String num = "";
        String tuoNum = "";
        String blueNum = "";

        for (String str : red) {
            num += str + " ";
        }

        if (redTuo != null) {
            for (String str : redTuo) {
                tuoNum += str + " ";
            }
        }

        for (String str : blue) {
            blueNum += str + " ";
        }
        if (type == 3901) {
            num = num.trim() + "-" + blueNum;
        } else if (type == 3903) {
            num = num + "," + " " + tuoNum.trim() + "-" + blueNum.trim();
        }

        return num;
    }

    public static String ChangeSFC(Map<Integer, String> MapNum) {
        String StrNum = "";
        String StrKey = "";
        System.out.println("号码Key：" + MapNum.keySet());
        for (int i = 0; i < 14; i++) {
            boolean b = false;
            Iterator j = MapNum.entrySet().iterator();
            while (j.hasNext()) {
                Entry entry = (Entry) j.next();
                int key = Integer.parseInt(entry.getKey().toString());
                if (i == key) {
                    b = true;
                }
            }
            if (b) {
                if (MapNum.get(i).length() < 2) {
                    StrNum += MapNum.get(i);
                } else {
                    StrNum += "(";
                    StrNum += MapNum.get(i);
                    StrNum += ")";
                }
            } else {
                StrNum += "-";
            }

        }
        return StrNum;
    }

    /**
     * 胆拖投注 根据红球 和篮球个数获取注数（ 双色球 (S) 6+1大乐透(D)是 5+2）
     *
     * @param RedCount
     *            所选的胆区红球个数
     * @param BlueCount
     *            所选的蓝球个数
     * @return
     */
    public static long getCountForSSQ_tuo(int RedCount, int RedCountTuo,
                                          int BlueCount, int redNum, int blueNum) {
        // 如果没有选满数字 则返回 0
        if ((RedCount < 1) || (BlueCount < blueNum)
                || (RedCountTuo < redNum - RedCount)) {
            return 0;
        }
        // 红球的排列总数 变量
        int RedInvestNum = 1;

        for (int i = 1; i <= (redNum - RedCount); i++) {
            RedInvestNum *= RedCountTuo;
            RedCountTuo--;
        }

        int RedInvestNum2 = 1;
        for (int i = 2; i <= (redNum - RedCount); i++) {
            RedInvestNum2 *= i;
        }

        RedInvestNum = RedInvestNum / RedInvestNum2;

        int BlueInvestNum = 1;
        for (int i = 1; i < blueNum + 1; i++) {
            BlueInvestNum *= BlueCount;
            BlueCount--;
        }

        int BlueInvestNum2 = 1;
        for (int i = 1; i < blueNum + 1; i++) {
            BlueInvestNum2 *= i;
        }
        BlueInvestNum = BlueInvestNum / BlueInvestNum2;

        return RedInvestNum * BlueInvestNum;
    }

    /**
     * 计算3D注数
     *
     * @param playType
     *            玩法
     * @param hundreds
     *            百位
     * @param decade
     *            十位
     * @param units
     *            个位
     * @return index 区分组三 组六单式
     */
    public static int getCountForFC3D(int playType, int hundreds, int decade,
                                      int units,HashSet<String> hezhiSet,HashSet<String> zixuanhezhiSet) {
        if ((playType == 0)) {
            return 0;
        }
        int count = 0;
        switch (playType) {
            case 605:
            case 6305:
            case 606:
            case 6306: // 组选和值
                int sum1 = 0,
                        sum2 = 0;
                for (int i = 0; i < 10; i++) {
                    for (int j = 0; j < 10; j++) {
                        for (int j2 = 0; j2 < 10; j2++) {
                            if (playType == 6306 || playType == 606) {
                                for (String k : hezhiSet) {
                                    int vlues = Integer.parseInt(k);
                                    if (i != j && j != j2 && i != j2) {
                                        if (i + j + j2 == vlues) {
                                            sum1 += 1;
                                        }
                                    } else if ((i == j && j != j2)
                                            || (i == j2 && j != j2)
                                            || (j2 == j && i != j2))
                                        if (i + j + j2 == vlues) {
                                            sum2 += 1;
                                        }
                                    count = sum1 / 6 + sum2 / 3;
                                }
                            } else {
                                for (String string : zixuanhezhiSet) {
                                    if (i + j + j2 == Integer.parseInt(string)) {
                                        count += 1;
                                    }
                                }
                            }
                        }
                    }
                }
                break;
            case 601:
            case 6301:
                count = hundreds * decade * units;
                break;
            case 602:
            case 6302:
                count = hundreds * decade;
                break;
            case 604:
            case 6304:
                if (hundreds >= 2) {
                    count = hundreds * (hundreds - 1);
                }
                break;
            case 603:
            case 6303:
                if (hundreds > 3) {
                    count = hundreds * (hundreds - 1) * (hundreds - 2) / 6;
                }
                break;
        }
        return count;
    }

    /**
     * 计算时时乐注数
     *
     * @param playType
     *            玩法
     * @param hundreds
     *            百位
     * @param decade
     *            十位
     * @param units
     *            个位
     * @return index 区分组三 组六单式
     */
    public static int getCountForSSL(int playType, int hundreds, int decade,
                                     int units) {
        if ((playType == 0)) {
            return 0;
        }
        int count = 0;
        switch (playType) {
            case 2902:
                count = hundreds * decade * units;
                break;
            case 2905:
                if (units < 3) {
                    count = hundreds * decade;
                    break;
                } else {
                    if (units >= 3)
                        count = (units - 2) * 6 + (units - 3) * (units - 4);
                    break;
                }
            case 2904:
                if (hundreds >= 3) {
                    count = hundreds * (hundreds - 1) * (hundreds - 2) / 6;
                }
                break;
            case 2908:
                count = hundreds * decade;
                break;
            case 2909:
                count = decade * units;
                break;
            case 2910:
                count = hundreds;
                break;
            case 2911:
                count = units;

                break;
        }
        return count;
    }

    /**
     * 计算七星彩注数
     *
     * @param playType
     *            玩法
     * @param yi
     *            第一位
     * @param er
     *            第二位
     * @param san
     *            第三位
     * @param si
     *            第四位
     * @param wu
     *            第五位
     * @param liu
     *            第六位
     * @param qi
     *            第七位
     * @return 注数
     */
    public static long getCountForQXC(int playType, int yi, int er, int san, int si, int wu, int liu, int qi) {
        // TODO Auto-generated method stub
        if (playType == 0 || yi < 1 || er < 1 || san < 1 || si < 1 || wu < 1
                || liu < 1 || qi < 1) {
            return 0;
        }
        int count = 0;
        count = yi * er * san * si * wu * liu * qi;
        return count;
    }
    //四场进球
    public static long getCountForSCJQ(int playType, int oneH, int oneG, int twoH,int twoG, int threeH, int threeG, int fourH,int fourG) {
        // TODO Auto-generated method stub
        if (playType == 0 || oneH < 1 || oneG < 1 || twoH < 1 || twoG < 1 || threeH < 1
                || threeG < 1 || fourH < 1||fourG<1) {
            return 0;
        }
        int count = 0;
        count = oneH * oneG * twoH * twoG * threeH * threeG * fourH*fourG;
        return count;
    }
    // 胜负彩
    public static int getCountForSFC(Map<Integer, String> btnMap) {
        int count = 0;

        if (btnMap.size() < 14) {
            count = 0;
        } else {
            count = btnMap.get(0).length() * btnMap.get(1).length()
                    * btnMap.get(2).length() * btnMap.get(3).length()
                    * btnMap.get(4).length() * btnMap.get(5).length()
                    * btnMap.get(6).length() * btnMap.get(7).length()
                    * btnMap.get(8).length() * btnMap.get(9).length()
                    * btnMap.get(10).length() * btnMap.get(11).length()
                    * btnMap.get(12).length() * btnMap.get(13).length();
        }
        return count;
    }

    // 任选九
    public static int getCountForRX9(Map<Integer, String> btnMap) {
        int count = 0;
        if (btnMap.size() < 9) {
            count = 0;
        } else {
            count = 1;
            Iterator i = btnMap.entrySet().iterator();
            while (i.hasNext()) {
                Entry entry = (Entry) i.next();
                int key = Integer.parseInt(entry.getKey().toString());
                count = count * (btnMap.get(key).length());
            }
        }
        return count;
    }
    /**
     * 计算排列五注数
     *
     * @param playType
     *            玩法
     * @param yi
     *            第一位
     * @param er
     *            第二位
     * @param san
     *            第三位
     * @param si
     *            第四位
     * @param wu
     *            第五位
     * @return 注数
     */
    public static long getCountForPL5(int playType, int yi, int er, int san, int si, int wu) {
        // TODO Auto-generated method stub
        if (playType == 0 || yi < 1 || er < 1 || san < 1 || si < 1 || wu < 1) {
            return 0;
        }
        int count = 0;
        count = yi * er * san * si * wu;
        return count;
    }

    /**
     * 得到随机数
     *
     * @param count
     *            随机数个数
     * @param max
     *            随机数产生的最大数
     * @param type
     *            是否加 0
     * @return
     */
    public static ArrayList<String> getRandomNum7(int count, int max, boolean type) {
        ArrayList<String> list = new ArrayList<String>();
        String str = "";
        while (list.size() < count) {
            int a = (int) (Math.random() * (max + 1));
            if (a == 0)
                continue;

            if (type) {
                if (a < 10)
                    str = "0" + a;
                else
                    str = "" + a;
            } else {
                str = "" + a;
            }

            if (list.contains(str)) {
                continue;
            }

            list.add(str);
        }
        return list;
    }

    /**
     * 得到随机数
     *
     * @param count
     *            随机数个数
     * @param max
     *            随机数产生的最大数，从1开始到max
     */
    public static ArrayList<String> getRandomNum(int count, int max) {
        ArrayList<String> list = new ArrayList<String>();
        String str = "";
        while (list.size() < count) {
            int a = (int) (Math.random() * (max + 1));
            str = "" + a;
            if (list.contains(str)) {
                continue;
            }

            list.add(str);
        }
        return list;
    }

    /**
     * 得到随机数数组
     *
     * @param count
     *            几注
     * @param redNum
     *            红球个数
     * @param blueNum
     *            蓝球个数
     * @param max1
     *            红球最大数
     * @param max2
     *            蓝球最大数
     * @param type
     *            是否加 0
     * @return
     */
    public static String[] getRandom(int count, int redNum, int blueNum,int max1, int max2, boolean type, boolean canZero) {
        String[] str = new String[count];
        for (int i = 0; i < count; i++) {
            List<String> red = new ArrayList<String>();
            List<String> blue = new ArrayList<String>();
            while (red.size() < redNum) {
                String s = "";
                int a = (int) (Math.random() * (max1 + 1));
                if (!canZero) {
                    if (a == 0)
                        continue;
                }

                if (type) {
                    if (a < 10)
                        s = s + " 0" + a;
                    else
                        s = s + " " + a;
                } else {
                    s = s + " " + a;
                }

                if (red.contains(s)) {
                    continue;
                }

                red.add(s);
            }

            while (blue.size() < blueNum) {
                String s = "";
                int a = (int) (Math.random() * (max2 + 1));
                if (a == 0)
                    continue;

                if (type) {
                    if (a < 10)
                        s = s + " 0" + a;
                    else
                        s = s + " " + a;
                } else {
                    s = s + " " + a;
                }

                if (blue.contains(s)) {
                    continue;
                }

                blue.add(s);
            }

            Collections.sort(red);
            Collections.sort(blue);
            if (blueNum != 0) {
                str[i] = red.toString().trim().replace("[", "")
                        .replace("]", "").replace(",", "")
                        + "-"
                        + blue.toString().trim().replace("[", "")
                        .replace("]", "").replace(",", "");
            } else {
                str[i] = red.toString().trim().replace("[", "")
                        .replace("]", "").replace(",", "");
            }
        }

        return str;
    }

    /**
     * 得到随机数
     *
     * @param count
     *            随机数个数
     * @param max
     *            随机数产生的最大数
     * @return
     *      返回的是[1,max]中返回，01，04，10，这样的字符串数据；
     */
    public static HashSet<String> getRandomNum2(int count, int max) {
        HashSet<String> list = new HashSet<String>();
        String str = "";
        while (list.size() < count) {
            int a = (int) (Math.random() * (max + 1));
            if (a == 0)
                continue;
            if (a < 10)
                str = "0" + a;
            else
                str = "" + a;
            if (list.contains(str)) {
                continue;
            }
            list.add(str);
        }
        return list;
    }

    /**
     * 得到随机数
     *
     * @param count
     *            随机数个数
     * @param max
     *            随机数产生的最大数(不包含)
     * @return [0,max) 前面不加 0
     */
    public static HashSet<String> getRandomNum3(int count, int max) {

        HashSet<String> list = new HashSet<String>();
        while (list.size() < count) {
            int a = (int) (Math.random() * (max));
            if (list.contains(a + "")) {

                continue;
            }
            list.add(a + "");

        }

        return list;
    }

    /**
     * PL3 pl5 得到随机数
     *
     * @return (0,max) 前面不加 0 //
     */
    public static ArrayList<String> getRandomNum4(int count, int max) {
        ArrayList<String> list = new ArrayList<String>();

        while (list.size() < count) {
            int a = (int) (Math.random() * (max));
            if (list.contains(a + "")) {

                continue;
            }
            list.add(a + "");

        }
        return list;
    }

    /**
     * wulin 得到随机数
     *
     * ======= /** 快赢481 / 幸运彩 得到随机数 不含0 不含01 02 数可重性
     *
     * @return (0,max) 前面不加 0
     */
    public static ArrayList<String> getRandomNum8(int count, int max,
                                                  boolean iszero) {
        ArrayList<String> list = new ArrayList<String>();
        while (list.size() < count) {
            int a = (int) (Math.random() * (max + 1));

            if (iszero != true && a == 0)
                continue;

            list.add(a + "");
        }
        return list;
    }

    /**
     * wulin 得到随机数 >>>>>>> .r2402
     *
     * @return (0,max) 前面不加 0
     */
    public static ArrayList<String> getRandomNum6(int count, int max) {
        ArrayList<String> list = new ArrayList<String>();
        while (list.size() < count) {
            int a = (int) (Math.random() * (max + 1));
            if (a == 0)
                continue;
            if (list.contains(a + "")) {
                continue;
            }

            list.add(a + "");
        }
        return list;
    }

    /**
     * 得到随机数
     *
     * @return (0,max) 前面加 0
     */
    public static ArrayList<String> getRandomNum5(int count, int max) {
        ArrayList<String> list = new ArrayList<String>();
        while (list.size() < count) {
            int a = (int) (Math.random() * (max + 1));
            String b = "";
            if (a == 0)
                continue;
            if (a <= 9)
                b = "0" + a;
            else
                b = a + "";

            if (list.contains(b)) {
                continue;
            }
            Log.i("x", "随机数 ==== " + a);

            list.add(b);
        }
        return list;
    }

    public static ArrayList<String> getRandomNum(int count, int max,
                                                 HashSet<String> set) {
        ArrayList<String> list = new ArrayList<String>();
        while (list.size() < count) {
            int a = (int) (Math.random() * (max + 1));
            if (a == 0)
                continue;

            String b = "";
            if (a == 0)
                continue;
            if (a <= 9)
                b = "0" + a;
            else
                b = a + "";

            if (list.contains(b)) {
                continue;
            }
            if (set.contains(b)) {
                continue;
            }
            list.add(b);
        }
        return list;
    }

    public static ArrayList<String> getRandomNum2(int count, int max,
                                                  HashSet<String> set) {
        ArrayList<String> list = new ArrayList<String>();
        while (list.size() < count) {
            int a = (int) (Math.random() * (max + 1));
            if (a == 0)
                continue;

            if (a == 0)
                continue;

            if (list.contains(a + "")) {
                continue;
            }
            if (set.contains(a + "")) {
                continue;
            }

            Log.i("x", "摇一摇的数据=== " + a);
            list.add(a + "");
        }
        return list;
    }

    public static ArrayList<String> getRandomNum(int count, int max,
                                                 HashSet<String> set, HashSet<String> set2) {
        ArrayList<String> list = new ArrayList<String>();
        while (list.size() < count) {
            int a = (int) (Math.random() * (max));
            String b = "";
            if (a == 0)
                continue;
            if (a <= 9)
                b = "0" + a;
            else
                b = a + "";
            if (list.contains(b)) {
                continue;
            }
            if (set.contains(b)) {
                continue;
            }
            if (set2.contains(b)) {
                continue;
            }
            list.add(b);
        }
        return list;
    }

    public static ArrayList<String> getRandomNum2(int count, int max,
                                                  HashSet<String> set, HashSet<String> set2) {
        ArrayList<String> list = new ArrayList<String>();
        while (list.size() < count) {
            int a = (int) (Math.random() * (max));

            if (list.contains(a + "")) {
                continue;
            }
            if (set.contains(a + "")) {
                continue;
            }
            if (set2.contains(a + "")) {
                continue;
            }
            list.add(a + "");
        }
        return list;
    }

    /**
     * 产生一个[0,max)的一个随机数
     * @param max
     * @return
     */
    public static int getRandomNum(int max) {
        return (int) (Math.random() * max);
    }

    /**
     * 投注前号码格式转换
     *
     * @param playType
     *            玩法ID
     * @param lotteryNumber
     *            彩票号码
     * @return 转换之后的彩票号码
     */
    public static String lotteryNumberFormatConvert(int playType,
                                                    String lotteryNumber) {
        System.out.println("lotteryNumber==" + playType + "||" + lotteryNumber);
        if (lotteryNumber != "") {
            String[] tempLotterys = new String[] {};
            switch (playType) {
                case 601:
                case 6301:
                    if (lotteryNumber.contains("(")) {
                        break;
                    }
                    if (lotteryNumber.length() == 3) {
                        break;
                    }
                    tempLotterys = lotteryNumber.split(" ");

                    if (tempLotterys.length > 0) {
                        lotteryNumber = "";
                        for (String string : tempLotterys) {
                            if (string.length() > 1) {
                                lotteryNumber += "(" + string + ")";
                            } else {
                                lotteryNumber += string;
                            }
                        }

                    }
                    break;
                case 301:
                    if (lotteryNumber.contains("(")) {
                        break;
                    }
                    if (lotteryNumber.length() == 7) {
                        break;
                    }
                    tempLotterys = lotteryNumber.split(" ");

                    if (tempLotterys.length > 0) {
                        lotteryNumber = "";
                        for (String string : tempLotterys) {
                            if (string.length() > 1) {
                                lotteryNumber += "(" + string + ")";
                            } else {
                                lotteryNumber += string;
                            }
                        }
                    }
                    break;
                case 6401:
                    if (lotteryNumber.contains("(")) {
                        break;
                    }
                    if (lotteryNumber.length() == 5) {
                        break;
                    }
                    tempLotterys = lotteryNumber.split(" ");

                    if (tempLotterys.length > 0) {
                        lotteryNumber = "";
                        for (String string : tempLotterys) {
                            if (string.length() > 1) {
                                lotteryNumber += "(" + string + ")";
                            } else {
                                lotteryNumber += string;
                            }
                        }
                    }
                    break;
            }
        }
        System.out.println("lotteryNumber==" + lotteryNumber);
        return lotteryNumber;
    }

    /**
     * 时时乐投注前号码格式转换
     *
     * @param playType
     *            玩法ID
     * @param lotteryNumber
     *            彩票号码
     * @return 转换之后的彩票号码
     */
    public static String lotteryNumberFormatConvertSSL(int playType,
                                                       String lotteryNumber) {
        if (lotteryNumber != "") {
            System.out.println("lotteryNumber==" + lotteryNumber + "||"
                    + playType);
            String[] tempLotterys = new String[] {};
            switch (playType) {
                case 201:
                case 2902:
                case 2908:
                case 2909:
                    tempLotterys = lotteryNumber.split(" ");
                    if (tempLotterys.length > 0) {
                        lotteryNumber = "";
                        for (String string : tempLotterys) {
                            if (string.length() > 1) {
                                lotteryNumber += "(" + string + ")";
                            } else {
                                lotteryNumber += string;
                            }
                        }
                    }
                    break;
            }
        }
        System.out.println("转化后的lotteryNumber==" + lotteryNumber);
        return lotteryNumber;
    }

    /**
     * 11运夺金 任选（二三四五六七八）前（二三）组选 时时彩 一星复式，二星组选
     */
    public static int get11X5Count(int number, int size) {
        if (number == 0 || number < size)
            return 0;
        if (size == 1)
            return number;

        int total = 1;
        for (int i = 0; i < size; i++) {
            total *= number;
            number--;
        }
        int count = 1;
        for (int i = size; i > 0; i--) {
            count *= i;
        }

        total = total / count;
        return total;
    }

    public static int get11X5zuer(HashSet<String> list1, HashSet<String> list2) {
        int d = 0; //
        for (String string1 : list1) {
            for (String string2 : list2) {
                if (!string1.equals(string2)) {
                    d += 1;
                }
            }
        }
        return d;
    }

    public static int get11X5zusan(HashSet<String> list1,
                                   HashSet<String> list2, HashSet<String> list3) {
        int d = 0; //

        for (String string1 : list1) {
            for (String string2 : list2) {
                for (String string3 : list3) {
                    if (!string1.equals(string2) && !string3.equals(string1)
                            && !string3.equals(string2)) {
                        d += 1;
                    }
                }
            }
        }
        return d;
    }

    public static int get11X5Count_dan(int number, int number_tuo, int size) {
        if (number == 0 || number >= size)
            return 0;
        if (number + number_tuo == size)
            return 1;
        if (size - number == 1)
            return number_tuo;

        int total = 1;

        for (int i = 0; i < size - number; i++) {
            total *= number_tuo;
            number_tuo--;
        }

        int count = 1;
        for (int i = size - number; i > 0; i--) {
            count *= i;
        }

        total = total / count;
        return total;
    }

    /** 幸运赛车的注数算法 **/
    public static int getLuckRacingCount(HashSet<String> one,
                                         HashSet<String> two, HashSet<String> three, int type) {
        int total = 0;
        switch (type) {
            case 8701:
            case 8708:
            case 8713:
                total = one.size();
                break;
            // 前二
            case 8702:
                int r = 0;
                for (String str : one) {
                    for (String str2 : two) {
                        if (str.equals(str2))
                            r++;
                    }
                }
                total = r * (one.size() - 1) + (two.size() - r) * one.size();
                break;
            case 8709:
            case 8715:
                if( two.size()!= 1)
                    total = one.size() * two.size();
                break;
            case 8703:
                total = one.size() * (one.size() - 1);
                break;
            case 8704:
                if (two.size() == 1)
                    return 0;
                total = one.size() * two.size() * 2;
                break;
            case 8705:
                total = 0;
                for (String str : one) {
                    for (String str2 : two) {
                        if (!str.equals(str2)) {
                            for (String str3 : three) {
                                if (!str3.equals(str) && !str3.equals(str2))
                                    total++;
                            }
                        }
                    }
                }
                break;
            case 8706:
                int o = one.size();
                total = o * (o - 1) * (o - 2);
                break;
            case 8711:
                total = one.size() * two.size() * three.size();
                break;
            case 8712:
                if(one.size() == 1 && two.size() != 2)
                    total = one.size()*two.size()*(two.size()-1) * 3;
                else if(one.size() == 2 && two.size() != 1)
                    total = one.size()*two.size() * 3;
                break;
            case 8707:
                if (two.size() + one.size() < 4)
                    return 0;
                if (one.size() == 2)
                    total = two.size() * 6;
                else if (one.size() == 1)
                    total = two.size() * (two.size() - 1) / 2 * 6;
                break;
            case 8710:
                if(one.size()== 1 && two.size() != 1)
                    total = two.size() * 2;
                break;
            case 8714:
                total = (one.size() * (one.size() - 1)) / 2;
                break;
            case 8716:
                total = (one.size() * (one.size() - 1) * (one.size() - 2)) / 6;
                break;
            case 8717:
                if(one.size() == 1 && two.size() != 2){
                    total = two.size()*(two.size()-1)/2;
                }
                else if(one.size() == 2 && two.size() != 1)
                    total = two.size();
                break;
            default:
                total = 0;
                break;
        }

        return total;
    }

    /** 时时彩的注数算法 **/
    public static int getSSC_count(HashSet<String> one, HashSet<String> two,
                                   HashSet<String> three, HashSet<String> four, HashSet<String> five,
                                   int type) {
        int total = 0;
        switch (type) {
            case 1:
                total = one.size();
                break;
            case 2:
                total = one.size() * two.size();
                break;
            case 3:
                total = one.size() * (one.size() - 1) / 2;
                break;
            case 4:
                total = one.size() * two.size() * three.size();
                break;
            case 5:
                total = one.size() * (one.size() - 1);
                break;
            case 6:
                total = one.size() * (one.size() - 1) * (one.size() - 2) / 6;
                break;
            case 7:
            case 8:
                total = one.size() * two.size() * three.size() * four.size()
                        * five.size();
                break;
            case 9:
                total = 1;
                break;
            default:
                break;
        }
        return total;
    }

    /** 幸运彩的注数算法 **/
    public static int getluckWulin_count(HashSet<String> one,
                                         HashSet<String> two, HashSet<String> three, HashSet<String> four,
                                         HashSet<String> five, HashSet<String> six, int type) {
        int total = 0;
        switch (type) {
            case 1:
                total = one.size() + two.size() + three.size();
                break;
            case 2:
                if (one.size() == 0)
                    total = two.size() * three.size();
                else if (two.size() == 0)
                    total = one.size() * three.size();
                else if (three.size() == 0)
                    total = one.size() * two.size();
                break;
            case 3:
                total = one.size() * two.size() * three.size();
                break;
            case 4:
            case 11:
                total = four.size();
                break;
            case 5:
            case 6:
            case 7:
            case 8:
            case 9:
            case 10:
                int num = 1;
                int num2 = 1;
                int a = four.size();
                for (int i = 0; i < type - 3; i++) {
                    num *= a;
                    a--;
                }
                for (int j = type - 3; j > 0; j--) {
                    num2 *= j;
                }
                total = num / num2;
                break;
            case 12:
                total = 0;
                for (String str : four) {
                    for (String str2 : five) {
                        if (!str.equals(str2))
                            total++;
                    }
                }
                break;
            case 13:
                total = 0;
                for (String str : four) {
                    for (String str2 : five) {
                        if (!str.equals(str2)) {
                            for (String str3 : six) {
                                if (!str3.equals(str) && !str3.equals(str2))
                                    total++;
                            }
                        }
                    }
                }
                break;
            default:
                total = 0;
                break;
        }
        return total;
    }

    /** 2串1 **/
    public static int getAll2G1Mixed(List<String> list) {
        int count = 0;
        for (Integer i = 0; i < list.size(); i++) {
            for (int i_0 = 0; i_0 < list.get(i).length(); i_0++) {
                for (int j = i + 1; j < list.size(); j++) {
                    if (j == list.size())
                        continue;
                    for (int j_0 = 0; j_0 < list.get(j).length(); j_0++) {
                        count++;
                    }
                }
            }
        }
        return count;
    }

    /** 3串1 **/
    public static int getAll3G1Mixed(List<String> list) {
        int sum = 0;
        for (int i = 0; i < list.size(); i++) {
            for (int i_0 = 0; i_0 < list.get(i).length(); i_0++) {
                for (int j = i + 1; j < list.size(); j++) {
                    for (int j_0 = 0; j_0 < list.get(j).length(); j_0++) {
                        for (int k = j + 1; k < list.size(); k++) {
                            for (int k_0 = 0; k_0 < list.get(k).length(); k_0++) {
                                sum++;
                            }
                        }
                    }
                }
            }
        }
        return sum;
    }

    /** 3串3 **/
    public static int getAll3G3Mixed(List<String> list) {
        int sum = 0;
        for (int a1 = 0; a1 < list.size() - 2; a1++) {
            for (int a2 = a1 + 1; a2 < list.size() - 1; a2++) {
                for (int a3 = a2 + 1; a3 < list.size(); a3++) {
                    sum += getAll2G1Mixed(new ArrayList<String>(Arrays.asList(
                            list.get(a1), list.get(a2), list.get(a3))));
                }
            }
        }

        return sum;
    }

    /** 3串4 = 3串3 加 3串1 **/
    public static int getAll3G4Mixed(List<String> list) {
        int sum = 0;
        sum += getAll3G3Mixed(list);
        sum += getAll3G1Mixed(list);
        return sum;
    }

    /** 4串1 **/
    public static int getAll4G1Mixed(List<String> list) {
        int sum = 0;
        for (int i = 0; i < list.size(); i++) {
            for (int i_0 = 0; i_0 < list.get(i).length(); i_0++) {
                for (int j = i + 1; j < list.size(); j++) {
                    for (int j_0 = 0; j_0 < list.get(j).length(); j_0++) {
                        for (int k = j + 1; k < list.size(); k++) {
                            for (int k_0 = 0; k_0 < list.get(k).length(); k_0++) {
                                for (int x = k + 1; x < list.size(); x++) {
                                    for (int x_0 = 0; x_0 < list.get(x)
                                            .length(); x_0++) {
                                        sum++;
                                    }
                                }

                            }
                        }
                    }
                }
            }
        }
        return sum;
    }

    /** 4串4 **/
    public static int getAll4G4Mixed(List<String> list) {
        int sum = 0;
        for (int i = 0; i < list.size(); i++) {
            for (int j = i + 1; j < list.size(); j++) {
                for (int k = j + 1; k < list.size(); k++) {
                    for (int x = k + 1; x < list.size(); x++) {
                        sum += getAll3G1Mixed(Arrays.asList(list.get(i),
                                list.get(j), list.get(k), list.get(x)));
                    }
                }
            }
        }
        return sum;
    }

    /** 4串5 = 4串4 + 4串1 **/
    public static int getAll4G5Mixed(List<String> list) {
        int sum = 0;
        sum = getAll4G4Mixed(list) + getAll4G1Mixed(list);
        return sum;
    }

    /** 4串6 **/
    public static int getAll4G6Mixed(List<String> list) {
        int sum = 0;
        for (int i = 0; i < list.size(); i++) {
            for (int j = i + 1; j < list.size(); j++) {
                for (int k = j + 1; k < list.size(); k++) {
                    for (int x = k + 1; x < list.size(); x++) {
                        sum += getAll2G1Mixed(Arrays.asList(list.get(i),
                                list.get(j), list.get(k), list.get(x)));
                    }
                }
            }
        }
        return sum;
    }

    /** 4串11 **/
    public static int getAll4G11Mixed(List<String> list) {
        int sum = 0;
        sum += getAll4G6Mixed(list);
        sum += getAll4G4Mixed(list);
        for (int i = 0; i < list.size(); i++) {
            for (int j = i + 1; j < list.size(); j++) {
                for (int k = j + 1; k < list.size(); k++) {
                    for (int x = k + 1; x < list.size(); x++) {
                        sum += getAll4G1Mixed(Arrays.asList(list.get(i),
                                list.get(j), list.get(k), list.get(x)));

                    }
                }
            }
        }
        return sum;
    }

    /** 5串1 **/
    public static int getAll5G1Mixed(List<String> list) {
        int sum = 0;
        for (int i = 0; i < list.size(); i++) {
            for (int i_0 = 0; i_0 < list.get(i).length(); i_0++) {
                for (int j = i + 1; j < list.size(); j++) {
                    for (int j_0 = 0; j_0 < list.get(j).length(); j_0++) {
                        for (int k = j + 1; k < list.size(); k++) {
                            for (int k_0 = 0; k_0 < list.get(k).length(); k_0++) {
                                for (int x = k + 1; x < list.size(); x++) {
                                    for (int x_0 = 0; x_0 < list.get(x)
                                            .length(); x_0++) {
                                        for (int y = x + 1; y < list.size(); y++) {
                                            for (int y_0 = 0; y_0 < list.get(y)
                                                    .length(); y_0++) {
                                                sum++;
                                            }
                                        }

                                    }
                                }

                            }
                        }
                    }
                }
            }
        }
        return sum;
    }

    /** 5串5 **/
    public static int getAll5G5Mixed(List<String> list) {
        int sum = 0;
        for (int i = 0; i < list.size(); i++) {
            for (int j = i + 1; j < list.size(); j++) {
                for (int k = j + 1; k < list.size(); k++) {
                    for (int x = k + 1; x < list.size(); x++) {
                        for (int y = x + 1; y < list.size(); y++) {
                            sum += getAll4G1Mixed(Arrays.asList(list.get(i),
                                    list.get(j), list.get(k), list.get(x),
                                    list.get(y)));
                        }
                    }
                }

            }
        }
        return sum;
    }

    /** 5串6 **/
    public static int getAll5G6Mixed(List<String> list) {
        int sum = 0;
        sum += getAll5G5Mixed(list);
        sum += getAll5G1Mixed(list);
        return sum;
    }

    /** 5串10 **/
    public static int getAll5G10Mixed(List<String> list) {
        int sum = 0;
        for (int i = 0; i < list.size() - 4; i++) {
            for (int j = i + 1; j < list.size() - 3; j++) {
                for (int k = j + 1; k < list.size() - 2; k++) {
                    for (int x = k + 1; x < list.size() - 1; x++) {
                        for (int o = x + 1; o < list.size(); o++) {
                            sum += getAll2G1Mixed(Arrays.asList(list.get(i),
                                    list.get(j), list.get(k), list.get(x),
                                    list.get(o)));
                        }
                    }
                }
            }
        }
        return sum;
    }

    /** 5串16 **/
    public static int getAll5G16Mixed(List<String> list) {
        int sum = 0;
        for (int i = 0; i < list.size() - 4; i++) {
            for (int j = i + 1; j < list.size() - 3; j++) {
                for (int k = j + 1; k < list.size() - 2; k++) {
                    for (int x = k + 1; x < list.size() - 1; x++) {
                        for (int o = x + 1; o < list.size(); o++) {
                            sum += getAll3G1Mixed(Arrays.asList(list.get(i),
                                    list.get(j), list.get(k), list.get(x),
                                    list.get(o)));
                        }
                    }
                }

            }
        }
        sum += getAll5G5Mixed(list);
        sum += getAll5G1Mixed(list);
        return sum;
    }

    /** 5串20 **/
    public static int getAll5G20Mixed(List<String> list) {
        int sum = 0;
        sum += getAll5G10Mixed(list);
        for (int i = 0; i < list.size() - 4; i++) {
            for (int j = i + 1; j < list.size() - 3; j++) {
                for (int k = j + 1; k < list.size() - 2; k++) {
                    for (int x = k + 1; x < list.size() - 1; x++) {
                        for (int o = x + 1; o < list.size(); o++) {
                            sum += getAll3G1Mixed(Arrays.asList(list.get(i),
                                    list.get(j), list.get(k), list.get(x),
                                    list.get(o)));
                        }
                    }
                }

            }
        }
        return sum;
    }

    /** 5串26 **/
    public static int getAll5G26Mixed(List<String> list) {
        int sum = 0;
        sum += getAll5G10Mixed(list);
        sum += getAll5G16Mixed(list);
        return sum;
    }

    /** 6串1 **/
    public static int getAll6G1Mixed(List<String> list) {
        int sum = 0;
        for (int i = 0; i < list.size(); i++) {
            for (int i_0 = 0; i_0 < list.get(i).length(); i_0++) {
                for (int j = i + 1; j < list.size(); j++) {
                    for (int j_0 = 0; j_0 < list.get(j).length(); j_0++) {
                        for (int k = j + 1; k < list.size(); k++) {
                            for (int k_0 = 0; k_0 < list.get(k).length(); k_0++) {
                                for (int x = k + 1; x < list.size(); x++) {
                                    for (int x_0 = 0; x_0 < list.get(x)
                                            .length(); x_0++) {
                                        for (int y = x + 1; y < list.size(); y++) {
                                            for (int y_0 = 0; y_0 < list.get(y)
                                                    .length(); y_0++) {
                                                for (int z = y + 1; z < list
                                                        .size(); z++) {
                                                    for (int z_0 = 0; z_0 < list
                                                            .get(z).length(); z_0++) {
                                                        sum++;
                                                    }
                                                }

                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
        return sum;
    }

    /** 6串6 **/
    public static int getAll6G6Mixed(List<String> list) {
        int sum = 0;
        for (int i = 0; i < list.size() - 5; i++) {
            for (int j = i + 1; j < list.size() - 4; j++) {
                for (int k = j + 1; k < list.size() - 3; k++) {
                    for (int x = k + 1; x < list.size() - 2; x++) {
                        for (int y = x + 1; y < list.size() - 1; y++) {
                            for (int z = y + 1; z < list.size(); z++) {
                                sum += getAll5G1Mixed(Arrays.asList(
                                        list.get(i), list.get(j), list.get(k),
                                        list.get(x), list.get(y), list.get(z)));
                            }
                        }
                    }
                }

            }
        }
        return sum;
    }

    /** 6串7 **/
    public static int getAll6G7Mixed(List<String> list) {
        int sum = 0;
        sum = getAll6G6Mixed(list) + getAll6G1Mixed(list);
        return sum;
    }

    /** 6串15 **/
    public static int getAll6G15Mixed(List<String> list) {
        int sum = 0;
        for (int i = 0; i < list.size() - 5; i++) {
            for (int j = i + 1; j < list.size() - 4; j++) {
                for (int k = j + 1; k < list.size() - 3; k++) {
                    for (int x = k + 1; x < list.size() - 2; x++) {
                        for (int y = x + 1; y < list.size() - 1; y++) {
                            for (int z = y + 1; z < list.size(); z++) {
                                sum += getAll2G1Mixed(Arrays.asList(
                                        list.get(i), list.get(j), list.get(k),
                                        list.get(x), list.get(y), list.get(z)));
                            }
                        }
                    }
                }
            }
        }
        return sum;
    }

    /** 6串20 **/
    public static int getAll6G20Mixed(List<String> list) {
        int sum = 0;
        for (int i = 0; i < list.size() - 5; i++) {
            for (int j = i + 1; j < list.size() - 4; j++) {
                for (int k = j + 1; k < list.size() - 3; k++) {
                    for (int x = k + 1; x < list.size() - 2; x++) {
                        for (int y = x + 1; y < list.size() - 1; y++) {
                            for (int z = y + 1; z < list.size(); z++) {
                                sum += getAll3G1Mixed(Arrays.asList(
                                        list.get(i), list.get(j), list.get(k),
                                        list.get(x), list.get(y), list.get(z)));
                            }
                        }
                    }
                }

            }
        }
        return sum;
    }

    /** 6串22 **/
    public static int getAll6G22Mixed(List<String> list) {
        int sum = 0;
        for (int i = 0; i < list.size() - 5; i++) {
            for (int j = i + 1; j < list.size() - 4; j++) {
                for (int k = j + 1; k < list.size() - 3; k++) {
                    for (int x = k + 1; x < list.size() - 2; x++) {
                        for (int y = x + 1; y < list.size() - 1; y++) {
                            for (int z = y + 1; z < list.size(); z++) {
                                sum += getAll4G1Mixed(Arrays.asList(
                                        list.get(i), list.get(j), list.get(k),
                                        list.get(x), list.get(y), list.get(z)));
                            }
                        }
                    }
                }

            }
        }
        sum += getAll6G6Mixed(list) + getAll6G1Mixed(list);
        return sum;
    }

    /** 6串35 **/
    public static int getAll6G35Mixed(List<String> list) {
        int sum = 0;
        sum = getAll6G15Mixed(list) + getAll6G20Mixed(list);
        return sum;
    }

    /** 6串42 **/
    public static int getAll6G42Mixed(List<String> list) {
        int sum = 0;
        sum = getAll6G20Mixed(list) + getAll6G22Mixed(list);
        return sum;
    }

    /** 6串50 **/
    public static int getAll6G50Mixed(List<String> list) {
        int sum = 0;
        sum = getAll6G35Mixed(list);
        for (int i = 0; i < list.size() - 5; i++) {
            for (int j = i + 1; j < list.size() - 4; j++) {
                for (int k = j + 1; k < list.size() - 3; k++) {
                    for (int x = k + 1; x < list.size() - 2; x++) {
                        for (int y = x + 1; y < list.size() - 1; y++) {
                            for (int z = y + 1; z < list.size(); z++) {
                                sum += getAll4G1Mixed(Arrays.asList(
                                        list.get(i), list.get(j), list.get(k),
                                        list.get(x), list.get(y), list.get(z)));
                            }
                        }
                    }
                }

            }
        }
        return sum;
    }

    /** 6串57 **/
    public static int getAll6G57Mixed(List<String> list) {
        int sum = 0;
        sum = getAll6G15Mixed(list) + getAll6G42Mixed(list);
        return sum;
    }

    /** 7串1 **/
    public static int getAll7G1Mixed(List<String> list) {
        int sum = 0;
        for (int i = 0; i < list.size(); i++) {
            for (int i_0 = 0; i_0 < list.get(i).length(); i_0++) {
                for (int j = i + 1; j < list.size(); j++) {
                    for (int j_0 = 0; j_0 < list.get(j).length(); j_0++) {
                        for (int k = j + 1; k < list.size(); k++) {
                            for (int k_0 = 0; k_0 < list.get(k).length(); k_0++) {
                                for (int x = k + 1; x < list.size(); x++) {
                                    for (int x_0 = 0; x_0 < list.get(x)
                                            .length(); x_0++) {
                                        for (int y = x + 1; y < list.size(); y++) {
                                            for (int y_0 = 0; y_0 < list.get(y)
                                                    .length(); y_0++) {
                                                for (int z = y + 1; z < list
                                                        .size(); z++) {
                                                    for (int z_0 = 0; z_0 < list
                                                            .get(z).length(); z_0++) {
                                                        for (int a = z + 1; a < list
                                                                .size(); a++) {
                                                            for (int a_0 = 0; a_0 < list
                                                                    .get(a)
                                                                    .length(); a_0++) {
                                                                sum++;
                                                            }
                                                        }

                                                    }
                                                }

                                            }
                                        }

                                    }
                                }

                            }
                        }
                    }
                }
            }
        }
        return sum;
    }

    /** 7串7 **/
    public static int getAll7G7Mixed(List<String> list) {
        int sum = 0;
        for (int i = 0; i < list.size() - 6; i++) {
            for (int j = i + 1; j < list.size() - 5; j++) {
                for (int k = j + 1; k < list.size() - 4; k++) {
                    for (int x = k + 1; x < list.size() - 3; x++) {
                        for (int y = x + 1; y < list.size() - 2; y++) {
                            for (int z = y + 1; z < list.size() - 1; z++) {
                                for (int a = z + 1; a < list.size(); a++) {
                                    sum += getAll6G1Mixed(Arrays.asList(
                                            list.get(i), list.get(j),
                                            list.get(k), list.get(x),
                                            list.get(y), list.get(z),
                                            list.get(a)));
                                }
                            }
                        }
                    }
                }

            }
        }
        return sum;
    }

    /** 7串8 **/
    public static int getAll7G8Mixed(List<String> list) {
        int sum = 0;
        sum = getAll7G7Mixed(list) + getAll7G1Mixed(list);
        return sum;
    }

    /** 7串21 **/
    public static int getAll7G21Mixed(List<String> list) {
        int sum = 0;
        for (int i = 0; i < list.size() - 6; i++) {
            for (int j = i + 1; j < list.size() - 5; j++) {
                for (int k = j + 1; k < list.size() - 4; k++) {
                    for (int x = k + 1; x < list.size() - 3; x++) {
                        for (int y = x + 1; y < list.size() - 2; y++) {
                            for (int z = y + 1; z < list.size() - 1; z++) {
                                for (int a = z + 1; a < list.size(); a++) {
                                    sum += getAll5G1Mixed(Arrays.asList(
                                            list.get(i), list.get(j),
                                            list.get(k), list.get(x),
                                            list.get(y), list.get(z),
                                            list.get(a)));
                                }
                            }
                        }
                    }
                }

            }
        }
        return sum;
    }

    /** 7串35 **/
    public static int getAll7G35Mixed(List<String> list) {
        int sum = 0;
        for (int i = 0; i < list.size() - 6; i++) {
            for (int j = i + 1; j < list.size() - 5; j++) {
                for (int k = j + 1; k < list.size() - 4; k++) {
                    for (int x = k + 1; x < list.size() - 3; x++) {
                        for (int y = x + 1; y < list.size() - 2; y++) {
                            for (int z = y + 1; z < list.size() - 1; z++) {
                                for (int a = z + 1; a < list.size(); a++) {
                                    sum += getAll4G1Mixed(Arrays.asList(
                                            list.get(i), list.get(j),
                                            list.get(k), list.get(x),
                                            list.get(y), list.get(z),
                                            list.get(a)));
                                }
                            }
                        }
                    }
                }

            }
        }
        return sum;
    }

    /** 7串120 **/
    public static int getAll7G120Mixed(List<String> list) {
        int sum = 0;
        // 过 5 和 4 和 6 和 7
        sum = getAll7G21Mixed(list) + getAll7G35Mixed(list)
                + getAll7G7Mixed(list) + getAll7G1Mixed(list);
        for (int i = 0; i < list.size() - 6; i++) {
            for (int j = i + 1; j < list.size() - 5; j++) {
                for (int k = j + 1; k < list.size() - 4; k++) {
                    for (int x = k + 1; x < list.size() - 3; x++) {
                        for (int y = x + 1; y < list.size() - 2; y++) {
                            for (int z = y + 1; z < list.size() - 1; z++) {
                                for (int a = z + 1; a < list.size(); a++) {
                                    sum += getAll2G1Mixed(Arrays.asList(
                                            list.get(i), list.get(j),
                                            list.get(k), list.get(x),
                                            list.get(y), list.get(z),
                                            list.get(a)));
                                    sum += getAll3G1Mixed(Arrays.asList(
                                            list.get(i), list.get(j),
                                            list.get(k), list.get(x),
                                            list.get(y), list.get(z),
                                            list.get(a)));
                                }
                            }
                        }
                    }
                }

            }
        }
        return sum;
    }

    /** 8串1 **/
    public static int getAll8G1Mixed(List<String> list) {
        int sum = 0;
        for (int i = 0; i < list.size(); i++) {
            for (int i_0 = 0; i_0 < list.get(i).length(); i_0++) {
                for (int j = i + 1; j < list.size(); j++) {
                    for (int j_0 = 0; j_0 < list.get(j).length(); j_0++) {
                        for (int k = j + 1; k < list.size(); k++) {
                            for (int k_0 = 0; k_0 < list.get(k).length(); k_0++) {
                                for (int x = k + 1; x < list.size(); x++) {
                                    for (int x_0 = 0; x_0 < list.get(x)
                                            .length(); x_0++) {
                                        for (int y = x + 1; y < list.size(); y++) {
                                            for (int y_0 = 0; y_0 < list.get(y)
                                                    .length(); y_0++) {
                                                for (int z = y + 1; z < list
                                                        .size(); z++) {
                                                    for (int z_0 = 0; z_0 < list
                                                            .get(z).length(); z_0++) {
                                                        for (int a = z + 1; a < list
                                                                .size(); a++) {
                                                            for (int a_0 = 0; a_0 < list
                                                                    .get(a)
                                                                    .length(); a_0++) {
                                                                for (int b = a + 1; b < list
                                                                        .size(); b++) {
                                                                    for (int b_0 = 0; b_0 < list
                                                                            .get(b)
                                                                            .length(); b_0++) {
                                                                        sum++;
                                                                    }
                                                                }

                                                            }
                                                        }

                                                    }
                                                }

                                            }
                                        }

                                    }
                                }

                            }
                        }
                    }
                }
            }
        }
        return sum;
    }

    /** 8串8 **/
    public static int getAll8G8Mixed(List<String> list) {
        int sum = 0;
        for (int i = 0; i < list.size() - 6; i++) {
            for (int j = i + 1; j < list.size() - 5; j++) {
                for (int k = j + 1; k < list.size() - 4; k++) {
                    for (int x = k + 1; x < list.size() - 3; x++) {
                        for (int y = x + 1; y < list.size() - 2; y++) {
                            for (int z = y + 1; z < list.size() - 1; z++) {
                                for (int a = z + 1; a < list.size(); a++) {
                                    for (int b = a + 1; b < list.size(); b++) {
                                        sum += getAll7G1Mixed(Arrays.asList(
                                                list.get(i), list.get(j),
                                                list.get(k), list.get(x),
                                                list.get(y), list.get(z),
                                                list.get(a), list.get(b)));
                                    }
                                }
                            }
                        }
                    }
                }

            }
        }
        return sum;
    }

    /** 8串9 **/
    public static int getAll8G9Mixed(List<String> list) {
        int sum = 0;
        sum = getAll8G8Mixed(list) + getAll8G1Mixed(list);
        return sum;
    }

    /** 8串28 **/
    public static int getAll8G28Mixed(List<String> list) {
        int sum = 0;
        for (int i = 0; i < list.size() - 6; i++) {
            for (int j = i + 1; j < list.size() - 5; j++) {
                for (int k = j + 1; k < list.size() - 4; k++) {
                    for (int x = k + 1; x < list.size() - 3; x++) {
                        for (int y = x + 1; y < list.size() - 2; y++) {
                            for (int z = y + 1; z < list.size() - 1; z++) {
                                for (int a = z + 1; a < list.size(); a++) {
                                    for (int b = a + 1; b < list.size(); b++) {
                                        sum += getAll6G1Mixed(Arrays.asList(
                                                list.get(i), list.get(j),
                                                list.get(k), list.get(x),
                                                list.get(y), list.get(z),
                                                list.get(a), list.get(b)));
                                    }
                                }
                            }
                        }
                    }
                }

            }
        }
        return sum;
    }

    /** 8串56 **/
    public static int getAll8G56Mixed(List<String> list) {
        int sum = 0;
        for (int i = 0; i < list.size() - 6; i++) {
            for (int j = i + 1; j < list.size() - 5; j++) {
                for (int k = j + 1; k < list.size() - 4; k++) {
                    for (int x = k + 1; x < list.size() - 3; x++) {
                        for (int y = x + 1; y < list.size() - 2; y++) {
                            for (int z = y + 1; z < list.size() - 1; z++) {
                                for (int a = z + 1; a < list.size(); a++) {
                                    for (int b = a + 1; b < list.size(); b++) {
                                        sum += getAll5G1Mixed(Arrays.asList(
                                                list.get(i), list.get(j),
                                                list.get(k), list.get(x),
                                                list.get(y), list.get(z),
                                                list.get(a), list.get(b)));
                                    }
                                }
                            }
                        }
                    }
                }

            }
        }
        return sum;
    }

    /** 8串70 **/
    public static int getAll8G70Mixed(List<String> list) {
        int sum = 0;
        for (int i = 0; i < list.size() - 6; i++) {
            for (int j = i + 1; j < list.size() - 5; j++) {
                for (int k = j + 1; k < list.size() - 4; k++) {
                    for (int x = k + 1; x < list.size() - 3; x++) {
                        for (int y = x + 1; y < list.size() - 2; y++) {
                            for (int z = y + 1; z < list.size() - 1; z++) {
                                for (int a = z + 1; a < list.size(); a++) {
                                    for (int b = a + 1; b < list.size(); b++) {
                                        sum += getAll4G1Mixed(Arrays.asList(
                                                list.get(i), list.get(j),
                                                list.get(k), list.get(x),
                                                list.get(y), list.get(z),
                                                list.get(a), list.get(b)));
                                    }
                                }
                            }
                        }
                    }
                }

            }
        }
        return sum;
    }

    /** 8串247 **/
    public static int getAll8G247Mixed(List<String> list) {
        int sum = 0;
        for (int i = 0; i < list.size() - 6; i++) {
            for (int j = i + 1; j < list.size() - 5; j++) {
                for (int k = j + 1; k < list.size() - 4; k++) {
                    for (int x = k + 1; x < list.size() - 3; x++) {
                        for (int y = x + 1; y < list.size() - 2; y++) {
                            for (int z = y + 1; z < list.size() - 1; z++) {
                                for (int a = z + 1; a < list.size(); a++) {
                                    for (int b = a + 1; b < list.size(); b++) {
                                        sum += getAll2G1Mixed(Arrays.asList(
                                                list.get(i), list.get(j),
                                                list.get(k), list.get(x),
                                                list.get(y), list.get(z),
                                                list.get(a), list.get(b)));
                                        sum += getAll3G1Mixed(Arrays.asList(
                                                list.get(i), list.get(j),
                                                list.get(k), list.get(x),
                                                list.get(y), list.get(z),
                                                list.get(a), list.get(b)));
                                        sum += getAll4G1Mixed(Arrays.asList(
                                                list.get(i), list.get(j),
                                                list.get(k), list.get(x),
                                                list.get(y), list.get(z),
                                                list.get(a), list.get(b)));
                                        sum += getAll5G1Mixed(Arrays.asList(
                                                list.get(i), list.get(j),
                                                list.get(k), list.get(x),
                                                list.get(y), list.get(z),
                                                list.get(a), list.get(b)));
                                        sum += getAll6G1Mixed(Arrays.asList(
                                                list.get(i), list.get(j),
                                                list.get(k), list.get(x),
                                                list.get(y), list.get(z),
                                                list.get(a), list.get(b)));
                                        sum += getAll7G1Mixed(Arrays.asList(
                                                list.get(i), list.get(j),
                                                list.get(k), list.get(x),
                                                list.get(y), list.get(z),
                                                list.get(a), list.get(b)));
                                        sum += getAll8G1Mixed(Arrays.asList(
                                                list.get(i), list.get(j),
                                                list.get(k), list.get(x),
                                                list.get(y), list.get(z),
                                                list.get(a), list.get(b)));
                                    }
                                }
                            }
                        }
                    }
                }

            }
        }
        return sum;
    }

    /** 2串1 胆 **/
    public static int getAll2G1Mixed_dan(List<String> list_dan,
                                         List<String> list) {
        if (null == list_dan || list_dan.size() != 1)
            return 0;
        int count = 0;
        for (Integer i = 0; i < list.size(); i++) {
            count += list.get(i).length();
        }
        count = count * list_dan.get(0).length();
        return count;
    }

    /** n串1 胆 **/
    public static int getAllnG1Mixed_dan(List<String> list_dan,
                                         List<String> list, int n) {
        if (null == list_dan || list_dan.size() == 0 || list_dan.size() >= n)
            return 0;
        int sum = 0;

        int danCount = 1;
        for (int i = 0; i < list_dan.size(); i++) {
            danCount = danCount * list_dan.get(i).length();
        }

        System.out.println("dan ====count ===" + danCount);

        System.out.println("type===" + (n - list_dan.size()));
        switch (n - list_dan.size()) {
            case 1:
                for (int j = 0; j < list.size(); j++) {
                    sum += list.get(j).length();
                }
                break;
            case 2:
                sum = getAll2G1Mixed(list);
                break;
            case 3:
                sum = getAll3G1Mixed(list);
                break;
            case 4:
                sum = getAll4G1Mixed(list);
                break;
            case 5:
                sum = getAll5G1Mixed(list);
                break;
            case 6:
                sum = getAll6G1Mixed(list);
                break;
            case 7:
                sum = getAll7G1Mixed(list);
                break;
            default:
                break;
        }
        System.out.println("sum===count===" + sum);
        return danCount * sum;
    }

    /** 3串3 **/
    public static int getAll3G3Mixed_dan(List<String> list_dan,
                                         List<String> list) {
        int sum = 0;
        switch (list_dan.size()) {
            case 1:
                for (int j = 0; j < list.size(); j++) {
                    for (int k = j + 1; k < list.size(); k++) {
                        sum += getAll2G1Mixed(new ArrayList<String>(Arrays.asList(
                                list_dan.get(0), list.get(j), list.get(k))));
                    }
                }
                break;
            case 2:
                for (int i = 0; i < 1; i++) {
                    for (int k = 0; k < list.size(); k++) {
                        sum += getAll2G1Mixed(new ArrayList<String>(Arrays.asList(
                                list_dan.get(i), list_dan.get(i + 1), list.get(k))));
                    }
                }
                break;
            default:
                break;
        }

        return sum;
    }

    /** 3串4 = 3串3 加 3串1 **/
    public static int getAll3G4Mixed_dan(List<String> list_dan,
                                         List<String> list) {
        int sum = 0;
        sum += getAll3G3Mixed_dan(list_dan, list);
        sum += getAllnG1Mixed_dan(list_dan, list, 3);
        return sum;
    }

    /** 4串4 **/
    public static int getAll4G4Mixed_dan(List<String> list_dan,
                                         List<String> list) {
        int sum = 0;
        switch (list_dan.size()) {
            case 1:
                for (int i = 0; i < list.size(); i++) {
                    for (int j = i + 1; j < list.size(); j++) {
                        for (int k = j + 1; k < list.size(); k++) {
                            sum += getAll3G1Mixed(Arrays.asList(list_dan.get(0),
                                    list.get(i), list.get(j), list.get(k)));
                        }
                    }
                }
                break;
            case 2:
                for (int i = 0; i < list.size(); i++) {
                    for (int j = i + 1; j < list.size(); j++) {
                        sum += getAll3G1Mixed(Arrays.asList(list_dan.get(0),
                                list_dan.get(1), list.get(i), list.get(j)));
                    }
                }
                break;
            case 3:
                for (int i = 0; i < list.size(); i++) {
                    sum += getAll3G1Mixed(Arrays.asList(list_dan.get(0),
                            list_dan.get(1), list_dan.get(2), list.get(i)));
                }
                break;
        }

        return sum;
    }

    /** 4串5 = 4串4 + 4串1 **/
    public static int getAll4G5Mixed_dan(List<String> list_dan,
                                         List<String> list) {
        int sum = 0;
        sum = getAll4G4Mixed_dan(list_dan, list)
                + getAllnG1Mixed_dan(list_dan, list, 4);
        return sum;
    }

    /** 4串6 4串11 **/
    public static int getAll4G6_11Mixed_dan(List<String> list_dan,
                                            List<String> list, int type) {
        int sum = 0;
        System.out.println("list_dan.size====" + list_dan.size());
        switch (list_dan.size()) {
            case 1:
                for (int j = 0; j < list.size(); j++) {
                    for (int k = j + 1; k < list.size(); k++) {
                        for (int x = k + 1; x < list.size(); x++) {
                            if (type == 6) {
                                sum += getAll2G1Mixed(Arrays.asList(
                                        list_dan.get(0), list.get(j), list.get(k),
                                        list.get(x)));
                            } else {
                                sum += getAll4G1Mixed(Arrays.asList(
                                        list_dan.get(0), list.get(j), list.get(k),
                                        list.get(x)));
                            }
                        }
                    }
                }
                break;
            case 2:
                for (int j = 0; j < list.size(); j++) {
                    for (int k = j + 1; k < list.size(); k++) {
                        if (type == 6) {
                            sum += getAll2G1Mixed(Arrays.asList(list_dan.get(0),
                                    list_dan.get(1), list.get(j), list.get(k)));
                        } else {
                            sum += getAll4G1Mixed(Arrays.asList(list_dan.get(0),
                                    list_dan.get(1), list.get(j), list.get(k)));
                        }
                    }
                }
                break;
            case 3:
                for (int k = 0; k < list.size(); k++) {
                    if (type == 6) {
                        sum += getAll2G1Mixed(Arrays.asList(list_dan.get(0),
                                list_dan.get(1), list_dan.get(2), list.get(k)));
                    } else {
                        sum += getAll4G1Mixed(Arrays.asList(list_dan.get(0),
                                list_dan.get(1), list_dan.get(2), list.get(k)));
                    }
                }
                break;
        }

        if (type == 6)
            return sum;
        else {
            sum += getAll4G6_11Mixed_dan(list_dan, list, 6);
            sum += getAll4G4Mixed_dan(list_dan, list);
            return sum;
        }
    }

    /** 5串5 **/
    public static int getAll5G5Mixed_dan(List<String> list_dan,
                                         List<String> list) {
        int sum = 0;
        switch (list_dan.size()) {
            case 1:
                for (int i = 0; i < list.size(); i++) {
                    for (int j = i + 1; j < list.size(); j++) {
                        for (int k = j + 1; k < list.size(); k++) {
                            for (int g = k + 1; g < list.size(); g++) {
                                sum += getAll4G1Mixed(Arrays.asList(
                                        list_dan.get(0), list.get(i), list.get(j),
                                        list.get(k), list.get(g)));
                            }
                        }
                    }
                }
                break;
            case 2:
                for (int i = 0; i < list.size(); i++) {
                    for (int j = i + 1; j < list.size(); j++) {
                        for (int k = j + 1; k < list.size(); k++) {
                            sum += getAll4G1Mixed(Arrays.asList(list_dan.get(0),
                                    list_dan.get(1), list.get(i), list.get(j),
                                    list.get(k)));
                        }
                    }
                }
                break;
            case 3:
                for (int i = 0; i < list.size(); i++) {
                    for (int j = i + 1; j < list.size(); j++) {
                        sum += getAll4G1Mixed(Arrays.asList(list_dan.get(0),
                                list_dan.get(1), list_dan.get(2), list.get(i),
                                list.get(j)));
                    }
                }
                break;
            case 4:
                for (int i = 0; i < list.size(); i++) {
                    sum += getAll4G1Mixed(Arrays.asList(list_dan.get(0),
                            list_dan.get(1), list_dan.get(2), list_dan.get(3),
                            list.get(i)));
                }
                break;
        }

        return sum;
    }

    /** 5串6 **/
    public static int getAll5G6Mixed_dan(List<String> list_dan,
                                         List<String> list) {
        int sum = 0;
        sum += getAll5G5Mixed_dan(list_dan, list);
        sum += getAllnG1Mixed_dan(list_dan, list, 5);
        return sum;
    }

    /** 5串10 5串16 5串20 type ==10 为 5串10 **/
    public static int getAll5G10_16_20Mixed_dan(List<String> list_dan,
                                                List<String> list, int type) {
        int sum = 0;
        switch (list_dan.size()) {
            case 1:
                for (int j = 0; j < list.size() - 3; j++) {
                    for (int k = j + 1; k < list.size() - 2; k++) {
                        for (int x = k + 1; x < list.size() - 1; x++) {
                            for (int o = x + 1; o < list.size(); o++) {
                                if (type == 10)
                                    sum += getAll2G1Mixed(Arrays.asList(
                                            list_dan.get(0), list.get(j),
                                            list.get(k), list.get(x), list.get(o)));
                                else
                                    sum += getAll3G1Mixed(Arrays.asList(
                                            list_dan.get(0), list.get(j),
                                            list.get(k), list.get(x), list.get(o)));
                            }
                        }
                    }
                }
                break;
            case 2:
                for (int k = 0; k < list.size() - 2; k++) {
                    for (int x = k + 1; x < list.size() - 1; x++) {
                        for (int o = x + 1; o < list.size(); o++) {
                            if (type == 10)
                                sum += getAll2G1Mixed(Arrays.asList(
                                        list_dan.get(0), list_dan.get(1),
                                        list.get(k), list.get(x), list.get(o)));
                            else
                                sum += getAll3G1Mixed(Arrays.asList(
                                        list_dan.get(0), list_dan.get(1),
                                        list.get(k), list.get(x), list.get(o)));
                        }
                    }
                }
                break;
            case 3:
                for (int x = 0; x < list.size() - 1; x++) {
                    for (int o = x + 1; o < list.size(); o++) {
                        if (type == 10)
                            sum += getAll2G1Mixed(Arrays.asList(list_dan.get(0),
                                    list_dan.get(1), list_dan.get(2), list.get(x),
                                    list.get(o)));
                        else
                            sum += getAll3G1Mixed(Arrays.asList(list_dan.get(0),
                                    list_dan.get(1), list_dan.get(2), list.get(x),
                                    list.get(o)));
                    }
                }
                break;
            case 4:
                for (int o = 0; o < list.size(); o++) {
                    if (type == 10)
                        sum += getAll2G1Mixed(Arrays.asList(list_dan.get(0),
                                list_dan.get(1), list_dan.get(2), list_dan.get(3),
                                list.get(o)));
                    else
                        sum += getAll3G1Mixed(Arrays.asList(list_dan.get(0),
                                list_dan.get(1), list_dan.get(2), list_dan.get(3),
                                list.get(o)));
                }
                break;
        }

        if (type == 16) {
            sum += getAll5G5Mixed_dan(list_dan, list);
            sum += getAllnG1Mixed_dan(list_dan, list, 5);
        } else if (type == 20) {
            sum += getAll5G10_16_20Mixed_dan(list_dan, list, 10);
        }
        return sum;
    }

    /** 5串26 **/
    public static int getAll5G26Mixed_dan(List<String> list_dan,
                                          List<String> list) {
        int sum = 0;
        sum += getAll5G10_16_20Mixed_dan(list_dan, list, 10);
        sum += getAll5G10_16_20Mixed_dan(list_dan, list, 16);
        return sum;
    }

    /** 6串6 **/
    public static int getAll6G6Mixed_dan(List<String> list_dan,
                                         List<String> list) {
        int sum = 0;
        switch (list_dan.size()) {
            case 1:
                for (int j = 0; j < list.size() - 4; j++) {
                    for (int k = j + 1; k < list.size() - 3; k++) {
                        for (int x = k + 1; x < list.size() - 2; x++) {
                            for (int y = x + 1; y < list.size() - 1; y++) {
                                for (int z = y + 1; z < list.size(); z++) {
                                    sum += getAll5G1Mixed(Arrays.asList(
                                            list_dan.get(0), list.get(j),
                                            list.get(k), list.get(x), list.get(y),
                                            list.get(z)));
                                }
                            }
                        }
                    }
                }
                break;
            case 2:
                for (int k = 0; k < list.size() - 3; k++) {
                    for (int x = k + 1; x < list.size() - 2; x++) {
                        for (int y = x + 1; y < list.size() - 1; y++) {
                            for (int z = y + 1; z < list.size(); z++) {
                                sum += getAll5G1Mixed(Arrays.asList(
                                        list_dan.get(0), list_dan.get(1),
                                        list.get(k), list.get(x), list.get(y),
                                        list.get(z)));
                            }
                        }
                    }
                }
                break;
            case 3:
                for (int x = 0; x < list.size() - 2; x++) {
                    for (int y = x + 1; y < list.size() - 1; y++) {
                        for (int z = y + 1; z < list.size(); z++) {
                            sum += getAll5G1Mixed(Arrays.asList(list_dan.get(0),
                                    list_dan.get(1), list_dan.get(2), list.get(x),
                                    list.get(y), list.get(z)));
                        }
                    }
                }
                break;
            case 4:
                for (int y = 0; y < list.size() - 1; y++) {
                    for (int z = y + 1; z < list.size(); z++) {
                        sum += getAll5G1Mixed(Arrays.asList(list_dan.get(0),
                                list_dan.get(1), list_dan.get(2), list_dan.get(3),
                                list.get(y), list.get(z)));
                    }
                }
                break;
            case 5:
                for (int z = 0; z < list.size(); z++) {
                    sum += getAll5G1Mixed(Arrays.asList(list_dan.get(0),
                            list_dan.get(1), list_dan.get(2), list_dan.get(3),
                            list_dan.get(4), list.get(z)));
                }
                break;
        }

        return sum;
    }

    /** 6串7 **/
    public static int getAll6G7Mixed_dan(List<String> list_dan,
                                         List<String> list) {
        int sum = 0;
        sum = getAll6G6Mixed_dan(list_dan, list)
                + getAllnG1Mixed_dan(list_dan, list, 6);
        return sum;
    }

    /** 6串15 20 22 50 **/
    public static int getAll6G15_20_22_50Mixed_dan(List<String> list_dan,
                                                   List<String> list, int type) {
        int sum = 0;
        switch (list_dan.size()) {
            case 1:
                for (int j = 0; j < list.size() - 4; j++) {
                    for (int k = j + 1; k < list.size() - 3; k++) {
                        for (int x = k + 1; x < list.size() - 2; x++) {
                            for (int y = x + 1; y < list.size() - 1; y++) {
                                for (int z = y + 1; z < list.size(); z++) {
                                    if (type == 15)
                                        sum += getAll2G1Mixed(Arrays.asList(
                                                list_dan.get(0), list.get(j),
                                                list.get(k), list.get(x),
                                                list.get(y), list.get(z)));
                                    if (type == 20)
                                        sum += getAll3G1Mixed(Arrays.asList(
                                                list_dan.get(0), list.get(j),
                                                list.get(k), list.get(x),
                                                list.get(y), list.get(z)));
                                    if (type == 22 || type == 50)
                                        sum += getAll4G1Mixed(Arrays.asList(
                                                list_dan.get(0), list.get(j),
                                                list.get(k), list.get(x),
                                                list.get(y), list.get(z)));
                                }
                            }
                        }
                    }
                }
                break;
            case 2:
                for (int k = 0; k < list.size() - 3; k++) {
                    for (int x = k + 1; x < list.size() - 2; x++) {
                        for (int y = x + 1; y < list.size() - 1; y++) {
                            for (int z = y + 1; z < list.size(); z++) {
                                if (type == 15)
                                    sum += getAll2G1Mixed(Arrays.asList(
                                            list_dan.get(0), list_dan.get(1),
                                            list.get(k), list.get(x), list.get(y),
                                            list.get(z)));
                                if (type == 20)
                                    sum += getAll3G1Mixed(Arrays.asList(
                                            list_dan.get(0), list_dan.get(1),
                                            list.get(k), list.get(x), list.get(y),
                                            list.get(z)));
                                if (type == 22 || type == 50)
                                    sum += getAll4G1Mixed(Arrays.asList(
                                            list_dan.get(0), list_dan.get(1),
                                            list.get(k), list.get(x), list.get(y),
                                            list.get(z)));
                            }
                        }
                    }
                }
                break;
            case 3:
                for (int x = 0; x < list.size() - 2; x++) {
                    for (int y = x + 1; y < list.size() - 1; y++) {
                        for (int z = y + 1; z < list.size(); z++) {
                            if (type == 15)
                                sum += getAll2G1Mixed(Arrays.asList(
                                        list_dan.get(0), list_dan.get(1),
                                        list_dan.get(2), list.get(x), list.get(y),
                                        list.get(z)));
                            if (type == 20)
                                sum += getAll3G1Mixed(Arrays.asList(
                                        list_dan.get(0), list_dan.get(1),
                                        list_dan.get(2), list.get(x), list.get(y),
                                        list.get(z)));
                            if (type == 22 || type == 50)
                                sum += getAll4G1Mixed(Arrays.asList(
                                        list_dan.get(0), list_dan.get(1),
                                        list_dan.get(2), list.get(x), list.get(y),
                                        list.get(z)));
                        }
                    }
                }
                break;
            case 4:
                for (int y = 0; y < list.size() - 1; y++) {
                    for (int z = y + 1; z < list.size(); z++) {
                        if (type == 15)
                            sum += getAll2G1Mixed(Arrays.asList(list_dan.get(0),
                                    list_dan.get(1), list_dan.get(2),
                                    list_dan.get(3), list.get(y), list.get(z)));
                        if (type == 20)
                            sum += getAll3G1Mixed(Arrays.asList(list_dan.get(0),
                                    list_dan.get(1), list_dan.get(2),
                                    list_dan.get(3), list.get(y), list.get(z)));
                        if (type == 22 || type == 50)
                            sum += getAll4G1Mixed(Arrays.asList(list_dan.get(0),
                                    list_dan.get(1), list_dan.get(2),
                                    list_dan.get(3), list.get(y), list.get(z)));
                    }
                }
                break;
            case 5:
                for (int z = 0; z < list.size(); z++) {
                    if (type == 15)
                        sum += getAll2G1Mixed(Arrays.asList(list_dan.get(0),
                                list_dan.get(1), list_dan.get(2), list_dan.get(3),
                                list_dan.get(4), list.get(z)));
                    if (type == 20)
                        sum += getAll3G1Mixed(Arrays.asList(list_dan.get(0),
                                list_dan.get(1), list_dan.get(2), list_dan.get(3),
                                list_dan.get(4), list.get(z)));
                    if (type == 22 || type == 50)
                        sum += getAll4G1Mixed(Arrays.asList(list_dan.get(0),
                                list_dan.get(1), list_dan.get(2), list_dan.get(3),
                                list_dan.get(4), list.get(z)));
                }
                break;
        }

        if (type == 22)
            sum += getAll6G6Mixed_dan(list_dan, list)
                    + getAllnG1Mixed_dan(list_dan, list, 6);
        else if (type == 50)
            sum += getAll6G35Mixed_dan(list_dan, list);
        return sum;
    }

    /** 6串35 **/
    public static int getAll6G35Mixed_dan(List<String> list_dan,
                                          List<String> list) {
        int sum = 0;
        sum = getAll6G15_20_22_50Mixed_dan(list_dan, list, 15)
                + getAll6G15_20_22_50Mixed_dan(list_dan, list, 20);
        return sum;
    }

    /** 6串42 **/
    public static int getAll6G42Mixed_dan(List<String> list_dan,
                                          List<String> list) {
        int sum = 0;
        sum = getAll6G15_20_22_50Mixed_dan(list_dan, list, 20)
                + getAll6G15_20_22_50Mixed_dan(list_dan, list, 22);
        return sum;
    }

    /** 6串57 **/
    public static int getAll6G57Mixed_dan(List<String> list_dan,
                                          List<String> list) {
        int sum = 0;
        sum = getAll6G15_20_22_50Mixed_dan(list_dan, list, 15)
                + getAll6G42Mixed_dan(list_dan, list);
        return sum;
    }

    /** 7串7 7串21 7串35 7串120 **/
    public static int getAll7G7_21_35Mixed_dan(List<String> list_dan,
                                               List<String> list, int type) {
        int sum = 0;
        switch (list_dan.size()) {
            case 1:
                for (int j = 0; j < list.size() - 5; j++) {
                    for (int k = j + 1; k < list.size() - 4; k++) {
                        for (int x = k + 1; x < list.size() - 3; x++) {
                            for (int y = x + 1; y < list.size() - 2; y++) {
                                for (int z = y + 1; z < list.size() - 1; z++) {
                                    for (int a = z + 1; a < list.size(); a++) {
                                        if (type == 7)
                                            sum += getAll6G1Mixed(Arrays.asList(
                                                    list_dan.get(0), list.get(j),
                                                    list.get(k), list.get(x),
                                                    list.get(y), list.get(z),
                                                    list.get(a)));
                                        else if (type == 21)
                                            sum += getAll5G1Mixed(Arrays.asList(
                                                    list_dan.get(0), list.get(j),
                                                    list.get(k), list.get(x),
                                                    list.get(y), list.get(z),
                                                    list.get(a)));
                                        else if (type == 35)
                                            sum += getAll4G1Mixed(Arrays.asList(
                                                    list_dan.get(0), list.get(j),
                                                    list.get(k), list.get(x),
                                                    list.get(y), list.get(z),
                                                    list.get(a)));
                                        else if (type == 120) {
                                            sum += getAll2G1Mixed(Arrays.asList(
                                                    list_dan.get(0), list.get(j),
                                                    list.get(k), list.get(x),
                                                    list.get(y), list.get(z),
                                                    list.get(a)));
                                            sum += getAll3G1Mixed(Arrays.asList(
                                                    list_dan.get(0), list.get(j),
                                                    list.get(k), list.get(x),
                                                    list.get(y), list.get(z),
                                                    list.get(a)));
                                        }
                                    }
                                }
                            }
                        }
                    }

                }
                break;
            case 2:
                for (int k = 0; k < list.size() - 4; k++) {
                    for (int x = k + 1; x < list.size() - 3; x++) {
                        for (int y = x + 1; y < list.size() - 2; y++) {
                            for (int z = y + 1; z < list.size() - 1; z++) {
                                for (int a = z + 1; a < list.size(); a++) {
                                    if (type == 7)
                                        sum += getAll6G1Mixed(Arrays.asList(
                                                list_dan.get(0), list_dan.get(1),
                                                list.get(k), list.get(x),
                                                list.get(y), list.get(z),
                                                list.get(a)));
                                    if (type == 21)
                                        sum += getAll5G1Mixed(Arrays.asList(
                                                list_dan.get(0), list_dan.get(1),
                                                list.get(k), list.get(x),
                                                list.get(y), list.get(z),
                                                list.get(a)));
                                    if (type == 35)
                                        sum += getAll4G1Mixed(Arrays.asList(
                                                list_dan.get(0), list_dan.get(1),
                                                list.get(k), list.get(x),
                                                list.get(y), list.get(z),
                                                list.get(a)));
                                    else if (type == 120) {
                                        sum += getAll2G1Mixed(Arrays.asList(
                                                list_dan.get(0), list_dan.get(1),
                                                list.get(k), list.get(x),
                                                list.get(y), list.get(z),
                                                list.get(a)));
                                        sum += getAll3G1Mixed(Arrays.asList(
                                                list_dan.get(0), list_dan.get(1),
                                                list.get(k), list.get(x),
                                                list.get(y), list.get(z),
                                                list.get(a)));
                                    }
                                }
                            }
                        }
                    }

                }
            case 3:
                for (int x = 0; x < list.size() - 3; x++) {
                    for (int y = x + 1; y < list.size() - 2; y++) {
                        for (int z = y + 1; z < list.size() - 1; z++) {
                            for (int a = z + 1; a < list.size(); a++) {
                                if (type == 7)
                                    sum += getAll6G1Mixed(Arrays.asList(
                                            list_dan.get(0), list_dan.get(1),
                                            list_dan.get(2), list.get(x),
                                            list.get(y), list.get(z), list.get(a)));
                                if (type == 21)
                                    sum += getAll5G1Mixed(Arrays.asList(
                                            list_dan.get(0), list_dan.get(1),
                                            list_dan.get(2), list.get(x),
                                            list.get(y), list.get(z), list.get(a)));
                                if (type == 35)
                                    sum += getAll4G1Mixed(Arrays.asList(
                                            list_dan.get(0), list_dan.get(1),
                                            list_dan.get(2), list.get(x),
                                            list.get(y), list.get(z), list.get(a)));
                                else if (type == 120) {
                                    sum += getAll2G1Mixed(Arrays.asList(
                                            list_dan.get(0), list_dan.get(1),
                                            list_dan.get(2), list.get(x),
                                            list.get(y), list.get(z), list.get(a)));
                                    sum += getAll3G1Mixed(Arrays.asList(
                                            list_dan.get(0), list_dan.get(1),
                                            list_dan.get(2), list.get(x),
                                            list.get(y), list.get(z), list.get(a)));
                                }
                            }
                        }
                    }

                }
                break;
            case 4:
                for (int y = 0; y < list.size() - 2; y++) {
                    for (int z = y + 1; z < list.size() - 1; z++) {
                        for (int a = z + 1; a < list.size(); a++) {
                            if (type == 7)
                                sum += getAll6G1Mixed(Arrays.asList(
                                        list_dan.get(0), list_dan.get(1),
                                        list_dan.get(2), list_dan.get(3),
                                        list.get(y), list.get(z), list.get(a)));
                            if (type == 21)
                                sum += getAll5G1Mixed(Arrays.asList(
                                        list_dan.get(0), list_dan.get(1),
                                        list_dan.get(2), list_dan.get(3),
                                        list.get(y), list.get(z), list.get(a)));
                            if (type == 35)
                                sum += getAll4G1Mixed(Arrays.asList(
                                        list_dan.get(0), list_dan.get(1),
                                        list_dan.get(2), list_dan.get(3),
                                        list.get(y), list.get(z), list.get(a)));
                            else if (type == 120) {
                                sum += getAll2G1Mixed(Arrays.asList(
                                        list_dan.get(0), list_dan.get(1),
                                        list_dan.get(2), list_dan.get(3),
                                        list.get(y), list.get(z), list.get(a)));
                                sum += getAll3G1Mixed(Arrays.asList(
                                        list_dan.get(0), list_dan.get(1),
                                        list_dan.get(2), list_dan.get(3),
                                        list.get(y), list.get(z), list.get(a)));
                            }
                        }
                    }
                }
                break;
            case 5:
                for (int z = 0; z < list.size() - 1; z++) {
                    for (int a = z + 1; a < list.size(); a++) {
                        if (type == 7)
                            sum += getAll6G1Mixed(Arrays.asList(list_dan.get(0),
                                    list_dan.get(1), list_dan.get(2),
                                    list_dan.get(3), list_dan.get(4), list.get(z),
                                    list.get(a)));
                        if (type == 21)
                            sum += getAll5G1Mixed(Arrays.asList(list_dan.get(0),
                                    list_dan.get(1), list_dan.get(2),
                                    list_dan.get(3), list_dan.get(4), list.get(z),
                                    list.get(a)));
                        if (type == 35)
                            sum += getAll4G1Mixed(Arrays.asList(list_dan.get(0),
                                    list_dan.get(1), list_dan.get(2),
                                    list_dan.get(3), list_dan.get(4), list.get(z),
                                    list.get(a)));
                        else if (type == 120) {
                            sum += getAll2G1Mixed(Arrays.asList(list_dan.get(0),
                                    list_dan.get(1), list_dan.get(2),
                                    list_dan.get(3), list_dan.get(4), list.get(z),
                                    list.get(a)));
                            sum += getAll3G1Mixed(Arrays.asList(list_dan.get(0),
                                    list_dan.get(1), list_dan.get(2),
                                    list_dan.get(3), list_dan.get(4), list.get(z),
                                    list.get(a)));
                        }
                    }
                }
                break;
            case 6:
                for (int a = 0; a < list.size(); a++) {
                    if (type == 7)
                        sum += getAll6G1Mixed(Arrays.asList(list_dan.get(0),
                                list_dan.get(1), list_dan.get(2), list_dan.get(3),
                                list_dan.get(4), list_dan.get(5), list.get(a)));
                    if (type == 21)
                        sum += getAll5G1Mixed(Arrays.asList(list_dan.get(0),
                                list_dan.get(1), list_dan.get(2), list_dan.get(3),
                                list_dan.get(4), list_dan.get(5), list.get(a)));
                    if (type == 35)
                        sum += getAll4G1Mixed(Arrays.asList(list_dan.get(0),
                                list_dan.get(1), list_dan.get(2), list_dan.get(3),
                                list_dan.get(4), list_dan.get(5), list.get(a)));
                    else if (type == 120) {
                        sum += getAll2G1Mixed(Arrays.asList(list_dan.get(0),
                                list_dan.get(1), list_dan.get(2), list_dan.get(3),
                                list_dan.get(4), list_dan.get(5), list.get(a)));
                        sum += getAll3G1Mixed(Arrays.asList(list_dan.get(0),
                                list_dan.get(1), list_dan.get(2), list_dan.get(3),
                                list_dan.get(4), list_dan.get(5), list.get(a)));
                    }
                }
                break;
        }
        if (type == 120) {
            sum += getAll7G7_21_35Mixed_dan(list_dan, list, 21)
                    + getAll7G7_21_35Mixed_dan(list_dan, list, 35)
                    + getAll7G7_21_35Mixed_dan(list_dan, list, 7)
                    + getAllnG1Mixed_dan(list_dan, list, 7);
        }
        return sum;
    }

    /** 7串8 **/
    public static int getAll7G8Mixed_dan(List<String> list_dan,
                                         List<String> list) {
        int sum = 0;
        sum = getAll7G7_21_35Mixed_dan(list_dan, list, 7)
                + getAllnG1Mixed_dan(list_dan, list, 7);
        return sum;
    }

    /** 8串8 **/
    public static int getAll8G8_28_56_70_247Mixed_dan(List<String> list_dan,
                                                      List<String> list, int type) {
        int sum = 0;
        switch (list_dan.size()) {
            case 1:
                for (int j = 0; j < list.size() - 5; j++) {
                    for (int k = j + 1; k < list.size() - 4; k++) {
                        for (int x = k + 1; x < list.size() - 3; x++) {
                            for (int y = x + 1; y < list.size() - 2; y++) {
                                for (int z = y + 1; z < list.size() - 1; z++) {
                                    for (int a = z + 1; a < list.size(); a++) {
                                        for (int b = a + 1; b < list.size(); b++) {
                                            if (type == 8)
                                                sum += getAll7G1Mixed(Arrays
                                                        .asList(list_dan.get(0),
                                                                list.get(j),
                                                                list.get(k),
                                                                list.get(x),
                                                                list.get(y),
                                                                list.get(z),
                                                                list.get(a),
                                                                list.get(b)));
                                            else if (type == 28)
                                                sum += getAll6G1Mixed(Arrays
                                                        .asList(list_dan.get(0),
                                                                list.get(j),
                                                                list.get(k),
                                                                list.get(x),
                                                                list.get(y),
                                                                list.get(z),
                                                                list.get(a),
                                                                list.get(b)));
                                            else if (type == 56)
                                                sum += getAll5G1Mixed(Arrays
                                                        .asList(list_dan.get(0),
                                                                list.get(j),
                                                                list.get(k),
                                                                list.get(x),
                                                                list.get(y),
                                                                list.get(z),
                                                                list.get(a),
                                                                list.get(b)));
                                            else if (type == 70)
                                                sum += getAll4G1Mixed(Arrays
                                                        .asList(list_dan.get(0),
                                                                list.get(j),
                                                                list.get(k),
                                                                list.get(x),
                                                                list.get(y),
                                                                list.get(z),
                                                                list.get(a),
                                                                list.get(b)));
                                            else if (type == 247) {
                                                sum += getAll2G1Mixed(Arrays
                                                        .asList(list_dan.get(0),
                                                                list.get(j),
                                                                list.get(k),
                                                                list.get(x),
                                                                list.get(y),
                                                                list.get(z),
                                                                list.get(a),
                                                                list.get(b)));
                                                sum += getAll3G1Mixed(Arrays
                                                        .asList(list_dan.get(0),
                                                                list.get(j),
                                                                list.get(k),
                                                                list.get(x),
                                                                list.get(y),
                                                                list.get(z),
                                                                list.get(a),
                                                                list.get(b)));
                                                sum += getAll4G1Mixed(Arrays
                                                        .asList(list_dan.get(0),
                                                                list.get(j),
                                                                list.get(k),
                                                                list.get(x),
                                                                list.get(y),
                                                                list.get(z),
                                                                list.get(a),
                                                                list.get(b)));
                                                sum += getAll5G1Mixed(Arrays
                                                        .asList(list_dan.get(0),
                                                                list.get(j),
                                                                list.get(k),
                                                                list.get(x),
                                                                list.get(y),
                                                                list.get(z),
                                                                list.get(a),
                                                                list.get(b)));
                                                sum += getAll6G1Mixed(Arrays
                                                        .asList(list_dan.get(0),
                                                                list.get(j),
                                                                list.get(k),
                                                                list.get(x),
                                                                list.get(y),
                                                                list.get(z),
                                                                list.get(a),
                                                                list.get(b)));
                                                sum += getAll7G1Mixed(Arrays
                                                        .asList(list_dan.get(0),
                                                                list.get(j),
                                                                list.get(k),
                                                                list.get(x),
                                                                list.get(y),
                                                                list.get(z),
                                                                list.get(a),
                                                                list.get(b)));
                                                sum += getAll8G1Mixed(Arrays
                                                        .asList(list_dan.get(0),
                                                                list.get(j),
                                                                list.get(k),
                                                                list.get(x),
                                                                list.get(y),
                                                                list.get(z),
                                                                list.get(a),
                                                                list.get(b)));
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
                break;
            case 2:
                for (int k = 0; k < list.size() - 4; k++) {
                    for (int x = k + 1; x < list.size() - 3; x++) {
                        for (int y = x + 1; y < list.size() - 2; y++) {
                            for (int z = y + 1; z < list.size() - 1; z++) {
                                for (int a = z + 1; a < list.size(); a++) {
                                    for (int b = a + 1; b < list.size(); b++) {
                                        if (type == 8)
                                            sum += getAll7G1Mixed(Arrays.asList(
                                                    list_dan.get(0),
                                                    list_dan.get(1), list.get(k),
                                                    list.get(x), list.get(y),
                                                    list.get(z), list.get(a),
                                                    list.get(b)));
                                        else if (type == 28)
                                            sum += getAll6G1Mixed(Arrays.asList(
                                                    list_dan.get(0),
                                                    list_dan.get(1), list.get(k),
                                                    list.get(x), list.get(y),
                                                    list.get(z), list.get(a),
                                                    list.get(b)));
                                        else if (type == 56)
                                            sum += getAll5G1Mixed(Arrays.asList(
                                                    list_dan.get(0),
                                                    list_dan.get(1), list.get(k),
                                                    list.get(x), list.get(y),
                                                    list.get(z), list.get(a),
                                                    list.get(b)));
                                        else if (type == 70)
                                            sum += getAll4G1Mixed(Arrays.asList(
                                                    list_dan.get(0),
                                                    list_dan.get(1), list.get(k),
                                                    list.get(x), list.get(y),
                                                    list.get(z), list.get(a),
                                                    list.get(b)));
                                        else if (type == 247) {
                                            sum += getAll2G1Mixed(Arrays.asList(
                                                    list_dan.get(0),
                                                    list_dan.get(1), list.get(k),
                                                    list.get(x), list.get(y),
                                                    list.get(z), list.get(a),
                                                    list.get(b)));
                                            sum += getAll3G1Mixed(Arrays.asList(
                                                    list_dan.get(0),
                                                    list_dan.get(1), list.get(k),
                                                    list.get(x), list.get(y),
                                                    list.get(z), list.get(a),
                                                    list.get(b)));
                                            sum += getAll4G1Mixed(Arrays.asList(
                                                    list_dan.get(0),
                                                    list_dan.get(1), list.get(k),
                                                    list.get(x), list.get(y),
                                                    list.get(z), list.get(a),
                                                    list.get(b)));
                                            sum += getAll5G1Mixed(Arrays.asList(
                                                    list_dan.get(0),
                                                    list_dan.get(1), list.get(k),
                                                    list.get(x), list.get(y),
                                                    list.get(z), list.get(a),
                                                    list.get(b)));
                                            sum += getAll6G1Mixed(Arrays.asList(
                                                    list_dan.get(0),
                                                    list_dan.get(1), list.get(k),
                                                    list.get(x), list.get(y),
                                                    list.get(z), list.get(a),
                                                    list.get(b)));
                                            sum += getAll7G1Mixed(Arrays.asList(
                                                    list_dan.get(0),
                                                    list_dan.get(1), list.get(k),
                                                    list.get(x), list.get(y),
                                                    list.get(z), list.get(a),
                                                    list.get(b)));
                                            sum += getAll8G1Mixed(Arrays.asList(
                                                    list_dan.get(0),
                                                    list_dan.get(1), list.get(k),
                                                    list.get(x), list.get(y),
                                                    list.get(z), list.get(a),
                                                    list.get(b)));
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
                break;
            case 3:
                for (int x = 0; x < list.size() - 3; x++) {
                    for (int y = x + 1; y < list.size() - 2; y++) {
                        for (int z = y + 1; z < list.size() - 1; z++) {
                            for (int a = z + 1; a < list.size(); a++) {
                                for (int b = a + 1; b < list.size(); b++) {
                                    if (type == 8)
                                        sum += getAll7G1Mixed(Arrays.asList(
                                                list_dan.get(0), list_dan.get(1),
                                                list_dan.get(2), list.get(x),
                                                list.get(y), list.get(z),
                                                list.get(a), list.get(b)));
                                    else if (type == 28)
                                        sum += getAll6G1Mixed(Arrays.asList(
                                                list_dan.get(0), list_dan.get(1),
                                                list_dan.get(2), list.get(x),
                                                list.get(y), list.get(z),
                                                list.get(a), list.get(b)));
                                    else if (type == 56)
                                        sum += getAll5G1Mixed(Arrays.asList(
                                                list_dan.get(0), list_dan.get(1),
                                                list_dan.get(2), list.get(x),
                                                list.get(y), list.get(z),
                                                list.get(a), list.get(b)));
                                    else if (type == 70)
                                        sum += getAll4G1Mixed(Arrays.asList(
                                                list_dan.get(0), list_dan.get(1),
                                                list_dan.get(2), list.get(x),
                                                list.get(y), list.get(z),
                                                list.get(a), list.get(b)));
                                    else if (type == 247) {
                                        sum += getAll2G1Mixed(Arrays.asList(
                                                list_dan.get(0), list_dan.get(1),
                                                list_dan.get(2), list.get(x),
                                                list.get(y), list.get(z),
                                                list.get(a), list.get(b)));
                                        sum += getAll3G1Mixed(Arrays.asList(
                                                list_dan.get(0), list_dan.get(1),
                                                list_dan.get(2), list.get(x),
                                                list.get(y), list.get(z),
                                                list.get(a), list.get(b)));
                                        sum += getAll4G1Mixed(Arrays.asList(
                                                list_dan.get(0), list_dan.get(1),
                                                list_dan.get(2), list.get(x),
                                                list.get(y), list.get(z),
                                                list.get(a), list.get(b)));
                                        sum += getAll5G1Mixed(Arrays.asList(
                                                list_dan.get(0), list_dan.get(1),
                                                list_dan.get(2), list.get(x),
                                                list.get(y), list.get(z),
                                                list.get(a), list.get(b)));
                                        sum += getAll6G1Mixed(Arrays.asList(
                                                list_dan.get(0), list_dan.get(1),
                                                list_dan.get(2), list.get(x),
                                                list.get(y), list.get(z),
                                                list.get(a), list.get(b)));
                                        sum += getAll7G1Mixed(Arrays.asList(
                                                list_dan.get(0), list_dan.get(1),
                                                list_dan.get(2), list.get(x),
                                                list.get(y), list.get(z),
                                                list.get(a), list.get(b)));
                                        sum += getAll8G1Mixed(Arrays.asList(
                                                list_dan.get(0), list_dan.get(1),
                                                list_dan.get(2), list.get(x),
                                                list.get(y), list.get(z),
                                                list.get(a), list.get(b)));
                                    }
                                }
                            }
                        }
                    }
                }
                break;
            case 4:
                for (int y = 0; y < list.size() - 2; y++) {
                    for (int z = y + 1; z < list.size() - 1; z++) {
                        for (int a = z + 1; a < list.size(); a++) {
                            for (int b = a + 1; b < list.size(); b++) {
                                if (type == 8)
                                    sum += getAll7G1Mixed(Arrays.asList(
                                            list_dan.get(0), list_dan.get(1),
                                            list_dan.get(2), list_dan.get(3),
                                            list.get(y), list.get(z), list.get(a),
                                            list.get(b)));
                                else if (type == 28)
                                    sum += getAll6G1Mixed(Arrays.asList(
                                            list_dan.get(0), list_dan.get(1),
                                            list_dan.get(2), list_dan.get(3),
                                            list.get(y), list.get(z), list.get(a),
                                            list.get(b)));
                                else if (type == 56)
                                    sum += getAll5G1Mixed(Arrays.asList(
                                            list_dan.get(0), list_dan.get(1),
                                            list_dan.get(2), list_dan.get(3),
                                            list.get(y), list.get(z), list.get(a),
                                            list.get(b)));
                                else if (type == 70)
                                    sum += getAll4G1Mixed(Arrays.asList(
                                            list_dan.get(0), list_dan.get(1),
                                            list_dan.get(2), list_dan.get(3),
                                            list.get(y), list.get(z), list.get(a),
                                            list.get(b)));
                                else if (type == 247) {
                                    sum += getAll2G1Mixed(Arrays.asList(
                                            list_dan.get(0), list_dan.get(1),
                                            list_dan.get(2), list_dan.get(3),
                                            list.get(y), list.get(z), list.get(a),
                                            list.get(b)));
                                    sum += getAll3G1Mixed(Arrays.asList(
                                            list_dan.get(0), list_dan.get(1),
                                            list_dan.get(2), list_dan.get(3),
                                            list.get(y), list.get(z), list.get(a),
                                            list.get(b)));
                                    sum += getAll4G1Mixed(Arrays.asList(
                                            list_dan.get(0), list_dan.get(1),
                                            list_dan.get(2), list_dan.get(3),
                                            list.get(y), list.get(z), list.get(a),
                                            list.get(b)));
                                    sum += getAll5G1Mixed(Arrays.asList(
                                            list_dan.get(0), list_dan.get(1),
                                            list_dan.get(2), list_dan.get(3),
                                            list.get(y), list.get(z), list.get(a),
                                            list.get(b)));
                                    sum += getAll6G1Mixed(Arrays.asList(
                                            list_dan.get(0), list_dan.get(1),
                                            list_dan.get(2), list_dan.get(3),
                                            list.get(y), list.get(z), list.get(a),
                                            list.get(b)));
                                    sum += getAll7G1Mixed(Arrays.asList(
                                            list_dan.get(0), list_dan.get(1),
                                            list_dan.get(2), list_dan.get(3),
                                            list.get(y), list.get(z), list.get(a),
                                            list.get(b)));
                                    sum += getAll8G1Mixed(Arrays.asList(
                                            list_dan.get(0), list_dan.get(1),
                                            list_dan.get(2), list_dan.get(3),
                                            list.get(y), list.get(z), list.get(a),
                                            list.get(b)));
                                }
                            }
                        }
                    }
                }
                break;
            case 5:
                for (int z = 0; z < list.size() - 1; z++) {
                    for (int a = z + 1; a < list.size(); a++) {
                        for (int b = a + 1; b < list.size(); b++) {
                            if (type == 8)
                                sum += getAll7G1Mixed(Arrays.asList(
                                        list_dan.get(0), list_dan.get(1),
                                        list_dan.get(2), list_dan.get(3),
                                        list_dan.get(4), list.get(z), list.get(a),
                                        list.get(b)));
                            else if (type == 28)
                                sum += getAll6G1Mixed(Arrays.asList(
                                        list_dan.get(0), list_dan.get(1),
                                        list_dan.get(2), list_dan.get(3),
                                        list_dan.get(4), list.get(z), list.get(a),
                                        list.get(b)));
                            else if (type == 56)
                                sum += getAll5G1Mixed(Arrays.asList(
                                        list_dan.get(0), list_dan.get(1),
                                        list_dan.get(2), list_dan.get(3),
                                        list_dan.get(4), list.get(z), list.get(a),
                                        list.get(b)));
                            else if (type == 70)
                                sum += getAll4G1Mixed(Arrays.asList(
                                        list_dan.get(0), list_dan.get(1),
                                        list_dan.get(2), list_dan.get(3),
                                        list_dan.get(4), list.get(z), list.get(a),
                                        list.get(b)));
                            else if (type == 247) {
                                sum += getAll2G1Mixed(Arrays.asList(
                                        list_dan.get(0), list_dan.get(1),
                                        list_dan.get(2), list_dan.get(3),
                                        list_dan.get(4), list.get(z), list.get(a),
                                        list.get(b)));
                                sum += getAll3G1Mixed(Arrays.asList(
                                        list_dan.get(0), list_dan.get(1),
                                        list_dan.get(2), list_dan.get(3),
                                        list_dan.get(4), list.get(z), list.get(a),
                                        list.get(b)));
                                sum += getAll4G1Mixed(Arrays.asList(
                                        list_dan.get(0), list_dan.get(1),
                                        list_dan.get(2), list_dan.get(3),
                                        list_dan.get(4), list.get(z), list.get(a),
                                        list.get(b)));
                                sum += getAll5G1Mixed(Arrays.asList(
                                        list_dan.get(0), list_dan.get(1),
                                        list_dan.get(2), list_dan.get(3),
                                        list_dan.get(4), list.get(z), list.get(a),
                                        list.get(b)));
                                sum += getAll6G1Mixed(Arrays.asList(
                                        list_dan.get(0), list_dan.get(1),
                                        list_dan.get(2), list_dan.get(3),
                                        list_dan.get(4), list.get(z), list.get(a),
                                        list.get(b)));
                                sum += getAll7G1Mixed(Arrays.asList(
                                        list_dan.get(0), list_dan.get(1),
                                        list_dan.get(2), list_dan.get(3),
                                        list_dan.get(4), list.get(z), list.get(a),
                                        list.get(b)));
                                sum += getAll8G1Mixed(Arrays.asList(
                                        list_dan.get(0), list_dan.get(1),
                                        list_dan.get(2), list_dan.get(3),
                                        list_dan.get(4), list.get(z), list.get(a),
                                        list.get(b)));
                            }
                        }
                    }
                }
                break;
            case 6:
                for (int a = 0; a < list.size(); a++) {
                    for (int b = a + 1; b < list.size(); b++) {
                        if (type == 8)
                            sum += getAll7G1Mixed(Arrays.asList(list_dan.get(0),
                                    list_dan.get(1), list_dan.get(2),
                                    list_dan.get(3), list_dan.get(4),
                                    list_dan.get(5), list.get(a), list.get(b)));
                        else if (type == 28)
                            sum += getAll6G1Mixed(Arrays.asList(list_dan.get(0),
                                    list_dan.get(1), list_dan.get(2),
                                    list_dan.get(3), list_dan.get(4),
                                    list_dan.get(5), list.get(a), list.get(b)));
                        else if (type == 56)
                            sum += getAll5G1Mixed(Arrays.asList(list_dan.get(0),
                                    list_dan.get(1), list_dan.get(2),
                                    list_dan.get(3), list_dan.get(4),
                                    list_dan.get(5), list.get(a), list.get(b)));
                        else if (type == 70)
                            sum += getAll4G1Mixed(Arrays.asList(list_dan.get(0),
                                    list_dan.get(1), list_dan.get(2),
                                    list_dan.get(3), list_dan.get(4),
                                    list_dan.get(5), list.get(a), list.get(b)));
                        else if (type == 247) {
                            sum += getAll2G1Mixed(Arrays.asList(list_dan.get(0),
                                    list_dan.get(1), list_dan.get(2),
                                    list_dan.get(3), list_dan.get(4),
                                    list_dan.get(5), list.get(a), list.get(b)));
                            sum += getAll3G1Mixed(Arrays.asList(list_dan.get(0),
                                    list_dan.get(1), list_dan.get(2),
                                    list_dan.get(3), list_dan.get(4),
                                    list_dan.get(5), list.get(a), list.get(b)));
                            sum += getAll4G1Mixed(Arrays.asList(list_dan.get(0),
                                    list_dan.get(1), list_dan.get(2),
                                    list_dan.get(3), list_dan.get(4),
                                    list_dan.get(5), list.get(a), list.get(b)));
                            sum += getAll5G1Mixed(Arrays.asList(list_dan.get(0),
                                    list_dan.get(1), list_dan.get(2),
                                    list_dan.get(3), list_dan.get(4),
                                    list_dan.get(5), list.get(a), list.get(b)));
                            sum += getAll6G1Mixed(Arrays.asList(list_dan.get(0),
                                    list_dan.get(1), list_dan.get(2),
                                    list_dan.get(3), list_dan.get(4),
                                    list_dan.get(5), list.get(a), list.get(b)));
                            sum += getAll7G1Mixed(Arrays.asList(list_dan.get(0),
                                    list_dan.get(1), list_dan.get(2),
                                    list_dan.get(3), list_dan.get(4),
                                    list_dan.get(5), list.get(a), list.get(b)));
                            sum += getAll8G1Mixed(Arrays.asList(list_dan.get(0),
                                    list_dan.get(1), list_dan.get(2),
                                    list_dan.get(3), list_dan.get(4),
                                    list_dan.get(5), list.get(a), list.get(b)));
                        }
                    }
                }
                break;
            case 7:
                for (int b = 0; b < list.size(); b++) {
                    if (type == 8)
                        sum += getAll7G1Mixed(Arrays.asList(list_dan.get(0),
                                list_dan.get(1), list_dan.get(2), list_dan.get(3),
                                list_dan.get(4), list_dan.get(5), list_dan.get(6),
                                list.get(b)));
                    else if (type == 28)
                        sum += getAll6G1Mixed(Arrays.asList(list_dan.get(0),
                                list_dan.get(1), list_dan.get(2), list_dan.get(3),
                                list_dan.get(4), list_dan.get(5), list_dan.get(6),
                                list.get(b)));
                    else if (type == 56)
                        sum += getAll5G1Mixed(Arrays.asList(list_dan.get(0),
                                list_dan.get(1), list_dan.get(2), list_dan.get(3),
                                list_dan.get(4), list_dan.get(5), list_dan.get(6),
                                list.get(b)));
                    else if (type == 70)
                        sum += getAll4G1Mixed(Arrays.asList(list_dan.get(0),
                                list_dan.get(1), list_dan.get(2), list_dan.get(3),
                                list_dan.get(4), list_dan.get(5), list_dan.get(6),
                                list.get(b)));
                    else if (type == 247) {
                        sum += getAll2G1Mixed(Arrays.asList(list_dan.get(0),
                                list_dan.get(1), list_dan.get(2), list_dan.get(3),
                                list_dan.get(4), list_dan.get(5), list_dan.get(6),
                                list.get(b)));
                        sum += getAll3G1Mixed(Arrays.asList(list_dan.get(0),
                                list_dan.get(1), list_dan.get(2), list_dan.get(3),
                                list_dan.get(4), list_dan.get(5), list_dan.get(6),
                                list.get(b)));
                        sum += getAll4G1Mixed(Arrays.asList(list_dan.get(0),
                                list_dan.get(1), list_dan.get(2), list_dan.get(3),
                                list_dan.get(4), list_dan.get(5), list_dan.get(6),
                                list.get(b)));
                        sum += getAll5G1Mixed(Arrays.asList(list_dan.get(0),
                                list_dan.get(1), list_dan.get(2), list_dan.get(3),
                                list_dan.get(4), list_dan.get(5), list_dan.get(6),
                                list.get(b)));
                        sum += getAll6G1Mixed(Arrays.asList(list_dan.get(0),
                                list_dan.get(1), list_dan.get(2), list_dan.get(3),
                                list_dan.get(4), list_dan.get(5), list_dan.get(6),
                                list.get(b)));
                        sum += getAll7G1Mixed(Arrays.asList(list_dan.get(0),
                                list_dan.get(1), list_dan.get(2), list_dan.get(3),
                                list_dan.get(4), list_dan.get(5), list_dan.get(6),
                                list.get(b)));
                        sum += getAll8G1Mixed(Arrays.asList(list_dan.get(0),
                                list_dan.get(1), list_dan.get(2), list_dan.get(3),
                                list_dan.get(4), list_dan.get(5), list_dan.get(6),
                                list.get(b)));
                    }
                }
                break;
        }

        if (type == 120) {
            sum += getAll7G7_21_35Mixed_dan(list_dan, list, 21)
                    + getAll7G7_21_35Mixed_dan(list_dan, list, 35)
                    + getAll7G7_21_35Mixed_dan(list_dan, list, 7)
                    + getAllnG1Mixed_dan(list_dan, list, 7);
        }
        return sum;
    }

    /** 8串9 **/
    public static int getAll8G9Mixed_dan(List<String> list_dan,
                                         List<String> list) {
        int sum = 0;
        sum = getAll8G8_28_56_70_247Mixed_dan(list, list_dan, 8)
                + getAllnG1Mixed_dan(list_dan, list, 8);
        return sum;
    }

}
